mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-18 13:54:36 -05:00
Cleanup, update header files using clang-tidy.
This commit is contained in:
parent
c5246a6bc7
commit
8d0dd01997
28 changed files with 1101 additions and 1048 deletions
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#ifndef ROFI_DIALOG_COMBI_H
|
#ifndef ROFI_DIALOG_COMBI_H
|
||||||
#define ROFI_DIALOG_COMBI_H
|
#define ROFI_DIALOG_COMBI_H
|
||||||
|
#include "mode.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup COBIMode Combi
|
* @defgroup COBIMode Combi
|
||||||
|
|
|
@ -35,13 +35,13 @@
|
||||||
* List of available dialogs.
|
* List of available dialogs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dialogs/run.h"
|
|
||||||
#include "dialogs/ssh.h"
|
|
||||||
#include "dialogs/drun.h"
|
|
||||||
#include "dialogs/dmenu.h"
|
|
||||||
#include "dialogs/script.h"
|
|
||||||
#include "dialogs/window.h"
|
|
||||||
#include "dialogs/combi.h"
|
#include "dialogs/combi.h"
|
||||||
#include "dialogs/help-keys.h"
|
#include "dialogs/dmenu.h"
|
||||||
|
#include "dialogs/drun.h"
|
||||||
#include "dialogs/filebrowser.h"
|
#include "dialogs/filebrowser.h"
|
||||||
|
#include "dialogs/help-keys.h"
|
||||||
|
#include "dialogs/run.h"
|
||||||
|
#include "dialogs/script.h"
|
||||||
|
#include "dialogs/ssh.h"
|
||||||
|
#include "dialogs/window.h"
|
||||||
#endif // ROFI_DIALOGS_DIALOGS_H
|
#endif // ROFI_DIALOGS_DIALOGS_H
|
||||||
|
|
|
@ -40,12 +40,12 @@
|
||||||
*
|
*
|
||||||
* @returns TRUE if script was successful.
|
* @returns TRUE if script was successful.
|
||||||
*/
|
*/
|
||||||
int dmenu_switcher_dialog ( void );
|
int dmenu_switcher_dialog(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print dmenu mode commandline options to stdout, for use in help menu.
|
* Print dmenu mode commandline options to stdout, for use in help menu.
|
||||||
*/
|
*/
|
||||||
void print_dmenu_options ( void );
|
void print_dmenu_options(void);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif // ROFI_DIALOG_DMENU_H
|
#endif // ROFI_DIALOG_DMENU_H
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
#ifndef ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H
|
#ifndef ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H
|
||||||
#define ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H
|
#define ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H
|
||||||
|
|
||||||
typedef struct
|
#include <glib.h>
|
||||||
{
|
#include <mode.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
/** Entry content. (visible part) */
|
/** Entry content. (visible part) */
|
||||||
char *entry;
|
char *entry;
|
||||||
/** Icon name to display. */
|
/** Icon name to display. */
|
||||||
|
@ -26,5 +29,7 @@ typedef struct
|
||||||
*
|
*
|
||||||
* Updates entry with the parsed values from buffer.
|
* Updates entry with the parsed values from buffer.
|
||||||
*/
|
*/
|
||||||
void dmenuscript_parse_entry_extras ( G_GNUC_UNUSED Mode *sw, DmenuScriptEntry *entry, char *buffer, size_t length );
|
void dmenuscript_parse_entry_extras(G_GNUC_UNUSED Mode *sw,
|
||||||
|
DmenuScriptEntry *entry, char *buffer,
|
||||||
|
size_t length);
|
||||||
#endif // ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H
|
#endif // ROFI_DIALOGS_DMENU_SCRIPT_SHARED_H
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#ifndef ROFI_DIALOG_RUN_H
|
#ifndef ROFI_DIALOG_RUN_H
|
||||||
#define ROFI_DIALOG_RUN_H
|
#define ROFI_DIALOG_RUN_H
|
||||||
|
|
||||||
|
#include "mode.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup RUNMode Run
|
* @defgroup RUNMode Run
|
||||||
* @ingroup MODES
|
* @ingroup MODES
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
* @ingroup MODES
|
* @ingroup MODES
|
||||||
*
|
*
|
||||||
* SSH Mode, returns a list of known SSH hosts the user can log into.
|
* SSH Mode, returns a list of known SSH hosts the user can log into.
|
||||||
* It does this by parsing the SSH config file and optional the known host and host list
|
* It does this by parsing the SSH config file and optional the known host and
|
||||||
* It also keeps history of the last chosen hosts.
|
* host list It also keeps history of the last chosen hosts.
|
||||||
*
|
*
|
||||||
* This mode uses the following options from the #config object:
|
* This mode uses the following options from the #config object:
|
||||||
* * #Settings::ssh_command
|
* * #Settings::ssh_command
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#ifndef ROFI_HELPER_THEME_H
|
#ifndef ROFI_HELPER_THEME_H
|
||||||
#define ROFI_HELPER_THEME_H
|
#define ROFI_HELPER_THEME_H
|
||||||
#include <pango/pango.h>
|
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
#include <pango/pango.h>
|
||||||
/**
|
/**
|
||||||
* @defgroup HELPERS Helpers
|
* @defgroup HELPERS Helpers
|
||||||
* @{
|
* @{
|
||||||
|
@ -39,11 +39,15 @@
|
||||||
* @param input The input string to find the matches on
|
* @param input The input string to find the matches on
|
||||||
* @param retv The Attribute list to update with matches
|
* @param retv The Attribute list to update with matches
|
||||||
*
|
*
|
||||||
* Creates a set of pango attributes highlighting the matches found in the input string.
|
* Creates a set of pango attributes highlighting the matches found in the input
|
||||||
|
* string.
|
||||||
*
|
*
|
||||||
* @returns the updated retv list.
|
* @returns the updated retv list.
|
||||||
*/
|
*/
|
||||||
PangoAttrList *helper_token_match_get_pango_attr ( RofiHighlightColorStyle th, rofi_int_matcher **tokens, const char *input, PangoAttrList *retv );
|
PangoAttrList *helper_token_match_get_pango_attr(RofiHighlightColorStyle th,
|
||||||
|
rofi_int_matcher **tokens,
|
||||||
|
const char *input,
|
||||||
|
PangoAttrList *retv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param pfd Pango font description to validate.
|
* @param pfd Pango font description to validate.
|
||||||
|
@ -51,6 +55,6 @@ PangoAttrList *helper_token_match_get_pango_attr ( RofiHighlightColorStyle th, r
|
||||||
*
|
*
|
||||||
* @returns true if font is valid.
|
* @returns true if font is valid.
|
||||||
*/
|
*/
|
||||||
gboolean helper_validate_font ( PangoFontDescription *pfd, const char *font );
|
gboolean helper_validate_font(PangoFontDescription *pfd, const char *font);
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif // ROFI_HELPER_THEME_H
|
#endif // ROFI_HELPER_THEME_H
|
||||||
|
|
|
@ -48,7 +48,8 @@
|
||||||
* Sets the entry in the history, if it exists its use-count is incremented.
|
* Sets the entry in the history, if it exists its use-count is incremented.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void history_set ( const char *filename, const char *entry ) __attribute__( ( nonnull ) );
|
void history_set(const char *filename, const char *entry)
|
||||||
|
__attribute__((nonnull));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filename The filename of the history cache.
|
* @param filename The filename of the history cache.
|
||||||
|
@ -56,7 +57,8 @@ void history_set ( const char *filename, const char *entry ) __attribute__( ( no
|
||||||
*
|
*
|
||||||
* Removes the entry from the history.
|
* Removes the entry from the history.
|
||||||
*/
|
*/
|
||||||
void history_remove ( const char *filename, const char *entry ) __attribute__( ( nonnull ) );
|
void history_remove(const char *filename, const char *entry)
|
||||||
|
__attribute__((nonnull));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filename The filename of the history cache.
|
* @param filename The filename of the history cache.
|
||||||
|
@ -65,7 +67,8 @@ void history_remove ( const char *filename, const char *entry ) __attribute__( (
|
||||||
* Gets the entries in the list (in order of usage)
|
* Gets the entries in the list (in order of usage)
|
||||||
* @returns a list of entries length long. (and NULL terminated).
|
* @returns a list of entries length long. (and NULL terminated).
|
||||||
*/
|
*/
|
||||||
char ** history_get_list ( const char *filename, unsigned int * length ) __attribute__( ( nonnull ) );
|
char **history_get_list(const char *filename, unsigned int *length)
|
||||||
|
__attribute__((nonnull));
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif // ROFI_HISTORY_H
|
#endif // ROFI_HISTORY_H
|
||||||
|
|
|
@ -28,7 +28,8 @@
|
||||||
#ifndef ROFI_KEYB_H
|
#ifndef ROFI_KEYB_H
|
||||||
#define ROFI_KEYB_H
|
#define ROFI_KEYB_H
|
||||||
|
|
||||||
#include "nkutils-bindings.h"
|
#include <glib.h>
|
||||||
|
#include <nkutils-bindings.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup KEYB KeyboardBindings
|
* @defgroup KEYB KeyboardBindings
|
||||||
|
@ -39,8 +40,7 @@
|
||||||
/**
|
/**
|
||||||
* List of all scopes the mouse can interact on.
|
* List of all scopes the mouse can interact on.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
SCOPE_GLOBAL,
|
SCOPE_GLOBAL,
|
||||||
SCOPE_MOUSE_LISTVIEW,
|
SCOPE_MOUSE_LISTVIEW,
|
||||||
SCOPE_MOUSE_LISTVIEW_ELEMENT,
|
SCOPE_MOUSE_LISTVIEW_ELEMENT,
|
||||||
|
@ -55,8 +55,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* List of all possible actions that can be triggered by a keybinding.
|
* List of all possible actions that can be triggered by a keybinding.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Paste from primary clipboard */
|
/** Paste from primary clipboard */
|
||||||
PASTE_PRIMARY = 1,
|
PASTE_PRIMARY = 1,
|
||||||
/** Paste from secondary clipboard */
|
/** Paste from secondary clipboard */
|
||||||
|
@ -145,8 +144,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* Actions mouse can take on the ListView.
|
* Actions mouse can take on the ListView.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
SCROLL_LEFT = 1,
|
SCROLL_LEFT = 1,
|
||||||
SCROLL_RIGHT,
|
SCROLL_RIGHT,
|
||||||
SCROLL_DOWN,
|
SCROLL_DOWN,
|
||||||
|
@ -156,8 +154,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* Actions mouse can take on the ListView element.
|
* Actions mouse can take on the ListView element.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
SELECT_HOVERED_ENTRY = 1,
|
SELECT_HOVERED_ENTRY = 1,
|
||||||
ACCEPT_HOVERED_ENTRY,
|
ACCEPT_HOVERED_ENTRY,
|
||||||
ACCEPT_HOVERED_CUSTOM,
|
ACCEPT_HOVERED_CUSTOM,
|
||||||
|
@ -166,8 +163,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* Default mouse actions.
|
* Default mouse actions.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
MOUSE_CLICK_DOWN = 1,
|
MOUSE_CLICK_DOWN = 1,
|
||||||
MOUSE_CLICK_UP,
|
MOUSE_CLICK_UP,
|
||||||
MOUSE_DCLICK_DOWN,
|
MOUSE_DCLICK_DOWN,
|
||||||
|
@ -178,19 +174,19 @@ typedef enum
|
||||||
* Parse the keybindings.
|
* Parse the keybindings.
|
||||||
* This should be called after the setting system is initialized.
|
* This should be called after the setting system is initialized.
|
||||||
*/
|
*/
|
||||||
gboolean parse_keys_abe ( NkBindings *bindings );
|
gboolean parse_keys_abe(NkBindings *bindings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup the keybindings
|
* Setup the keybindings
|
||||||
* This adds all the entries to the settings system.
|
* This adds all the entries to the settings system.
|
||||||
*/
|
*/
|
||||||
void setup_abe ( void );
|
void setup_abe(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name Don't have the name.
|
* @param name Don't have the name.
|
||||||
*
|
*
|
||||||
* @returns id, or UINT32_MAX if not found.
|
* @returns id, or UINT32_MAX if not found.
|
||||||
*/
|
*/
|
||||||
guint key_binding_get_action_from_name ( const char *name );
|
guint key_binding_get_action_from_name(const char *name);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif // ROFI_KEYB_H
|
#endif // ROFI_KEYB_H
|
||||||
|
|
|
@ -38,20 +38,23 @@ G_BEGIN_DECLS
|
||||||
*
|
*
|
||||||
* Mode free function.
|
* Mode free function.
|
||||||
*/
|
*/
|
||||||
typedef void ( *_mode_free )( Mode *data );
|
typedef void (*_mode_free)(Mode *data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
* @param selected_line The selected line
|
* @param selected_line The selected line
|
||||||
* @param state The state to display [out]
|
* @param state The state to display [out]
|
||||||
* @param attribute_list List of extra (pango) attribute to apply when displaying. [out][null]
|
* @param attribute_list List of extra (pango) attribute to apply when
|
||||||
|
* displaying. [out][null]
|
||||||
* @param get_entry if it should only return the state
|
* @param get_entry if it should only return the state
|
||||||
*
|
*
|
||||||
* Get the value for displaying.
|
* Get the value for displaying.
|
||||||
*
|
*
|
||||||
* @return the string and state for displaying.
|
* @return the string and state for displaying.
|
||||||
*/
|
*/
|
||||||
typedef char * ( *_mode_get_display_value )( const Mode *sw, unsigned int selected_line, int *state, GList **attribute_list, int get_entry );
|
typedef char *(*_mode_get_display_value)(const Mode *sw,
|
||||||
|
unsigned int selected_line, int *state,
|
||||||
|
GList **attribute_list, int get_entry);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
@ -61,7 +64,9 @@ typedef char * ( *_mode_get_display_value )( const Mode *sw, unsigned int select
|
||||||
*
|
*
|
||||||
* @return Get the icon
|
* @return Get the icon
|
||||||
*/
|
*/
|
||||||
typedef cairo_surface_t * ( *_mode_get_icon )( const Mode *sw, unsigned int selected_line, int height );
|
typedef cairo_surface_t *(*_mode_get_icon)(const Mode *sw,
|
||||||
|
unsigned int selected_line,
|
||||||
|
int height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
@ -71,7 +76,8 @@ typedef cairo_surface_t * ( *_mode_get_icon )( const Mode *sw, unsigned int sele
|
||||||
*
|
*
|
||||||
* @return Get the completion string
|
* @return Get the completion string
|
||||||
*/
|
*/
|
||||||
typedef char * ( *_mode_get_completion )( const Mode *sw, unsigned int selected_line );
|
typedef char *(*_mode_get_completion)(const Mode *sw,
|
||||||
|
unsigned int selected_line);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tokens List of (input) tokens to match.
|
* @param tokens List of (input) tokens to match.
|
||||||
|
@ -84,7 +90,8 @@ typedef char * ( *_mode_get_completion )( const Mode *sw, unsigned int selected_
|
||||||
*
|
*
|
||||||
* @returns 1 when it matches, 0 if not.
|
* @returns 1 when it matches, 0 if not.
|
||||||
*/
|
*/
|
||||||
typedef int ( *_mode_token_match )( const Mode *data, rofi_int_matcher **tokens, unsigned int index );
|
typedef int (*_mode_token_match)(const Mode *data, rofi_int_matcher **tokens,
|
||||||
|
unsigned int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
@ -93,7 +100,7 @@ typedef int ( *_mode_token_match )( const Mode *data, rofi_int_matcher **tokens,
|
||||||
*
|
*
|
||||||
* @returns TRUE is successful
|
* @returns TRUE is successful
|
||||||
*/
|
*/
|
||||||
typedef int ( *__mode_init )( Mode *sw );
|
typedef int (*__mode_init)(Mode *sw);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
@ -102,7 +109,7 @@ typedef int ( *__mode_init )( Mode *sw );
|
||||||
*
|
*
|
||||||
* @returns the number of entries
|
* @returns the number of entries
|
||||||
*/
|
*/
|
||||||
typedef unsigned int ( *__mode_get_num_entries )( const Mode *sw );
|
typedef unsigned int (*__mode_get_num_entries)(const Mode *sw);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
@ -110,7 +117,7 @@ typedef unsigned int ( *__mode_get_num_entries )( const Mode *sw );
|
||||||
* Destroy the current mode. Still ready to restart.
|
* Destroy the current mode. Still ready to restart.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
typedef void ( *__mode_destroy )( Mode *sw );
|
typedef void (*__mode_destroy)(Mode *sw);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
@ -122,7 +129,8 @@ typedef void ( *__mode_destroy )( Mode *sw );
|
||||||
*
|
*
|
||||||
* @returns the next action to take
|
* @returns the next action to take
|
||||||
*/
|
*/
|
||||||
typedef ModeMode ( *_mode_result )( Mode *sw, int menu_retv, char **input, unsigned int selected_line );
|
typedef ModeMode (*_mode_result)(Mode *sw, int menu_retv, char **input,
|
||||||
|
unsigned int selected_line);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
@ -132,7 +140,7 @@ typedef ModeMode ( *_mode_result )( Mode *sw, int menu_retv, char **input, unsig
|
||||||
*
|
*
|
||||||
* @returns Entry stripped from markup for sorting
|
* @returns Entry stripped from markup for sorting
|
||||||
*/
|
*/
|
||||||
typedef char* ( *_mode_preprocess_input )( Mode *sw, const char *input );
|
typedef char *(*_mode_preprocess_input)(Mode *sw, const char *input);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sw The #Mode pointer
|
* @param sw The #Mode pointer
|
||||||
|
@ -141,15 +149,14 @@ typedef char* ( *_mode_preprocess_input )( Mode *sw, const char *input );
|
||||||
*
|
*
|
||||||
* @returns the (valid pango markup) message to display.
|
* @returns the (valid pango markup) message to display.
|
||||||
*/
|
*/
|
||||||
typedef char * ( *_mode_get_message )( const Mode *sw );
|
typedef char *(*_mode_get_message)(const Mode *sw);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure defining a switcher.
|
* Structure defining a switcher.
|
||||||
* It consists of a name, callback and if enabled
|
* It consists of a name, callback and if enabled
|
||||||
* a textbox for the sidebar-mode.
|
* a textbox for the sidebar-mode.
|
||||||
*/
|
*/
|
||||||
struct rofi_mode
|
struct rofi_mode {
|
||||||
{
|
|
||||||
/** Used for external plugins. */
|
/** Used for external plugins. */
|
||||||
unsigned int abi_version;
|
unsigned int abi_version;
|
||||||
/** Name (max 31 char long) */
|
/** Name (max 31 char long) */
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
|
|
||||||
#ifndef ROFI_MODE_H
|
#ifndef ROFI_MODE_H
|
||||||
#define ROFI_MODE_H
|
#define ROFI_MODE_H
|
||||||
#include <cairo.h>
|
|
||||||
#include "rofi-types.h"
|
#include "rofi-types.h"
|
||||||
|
#include <cairo.h>
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
/**
|
/**
|
||||||
* @defgroup MODE Mode
|
* @defgroup MODE Mode
|
||||||
|
@ -46,8 +46,7 @@ typedef struct rofi_mode Mode;
|
||||||
/**
|
/**
|
||||||
* Enum used to sum the possible states of ROFI.
|
* Enum used to sum the possible states of ROFI.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Exit. */
|
/** Exit. */
|
||||||
MODE_EXIT = 1000,
|
MODE_EXIT = 1000,
|
||||||
/** Skip to the next cycle-able dialog. */
|
/** Skip to the next cycle-able dialog. */
|
||||||
|
@ -63,8 +62,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* State returned by the rofi window.
|
* State returned by the rofi window.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Entry is selected. */
|
/** Entry is selected. */
|
||||||
MENU_OK = 0x00010000,
|
MENU_OK = 0x00010000,
|
||||||
/** User canceled the operation. (e.g. pressed escape) */
|
/** User canceled the operation. (e.g. pressed escape) */
|
||||||
|
@ -96,14 +94,14 @@ typedef enum
|
||||||
*
|
*
|
||||||
* @returns FALSE if there was a failure, TRUE if successful
|
* @returns FALSE if there was a failure, TRUE if successful
|
||||||
*/
|
*/
|
||||||
int mode_init ( Mode *mode );
|
int mode_init(Mode *mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to destroy
|
* @param mode The mode to destroy
|
||||||
*
|
*
|
||||||
* Destroy the mode
|
* Destroy the mode
|
||||||
*/
|
*/
|
||||||
void mode_destroy ( Mode *mode );
|
void mode_destroy(Mode *mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -112,20 +110,24 @@ void mode_destroy ( Mode *mode );
|
||||||
*
|
*
|
||||||
* @returns an unsigned int with the number of entries.
|
* @returns an unsigned int with the number of entries.
|
||||||
*/
|
*/
|
||||||
unsigned int mode_get_num_entries ( const Mode *mode );
|
unsigned int mode_get_num_entries(const Mode *mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
* @param selected_line The entry to query
|
* @param selected_line The entry to query
|
||||||
* @param state The state of the entry [out]
|
* @param state The state of the entry [out]
|
||||||
* @param attribute_list List of extra (pango) attribute to apply when displaying. [out][null]
|
* @param attribute_list List of extra (pango) attribute to apply when
|
||||||
|
* displaying. [out][null]
|
||||||
* @param get_entry If the should be returned.
|
* @param get_entry If the should be returned.
|
||||||
*
|
*
|
||||||
* Returns the string as it should be displayed for the entry and the state of how it should be displayed.
|
* Returns the string as it should be displayed for the entry and the state of
|
||||||
|
* how it should be displayed.
|
||||||
*
|
*
|
||||||
* @returns allocated new string and state when get_entry is TRUE otherwise just the state.
|
* @returns allocated new string and state when get_entry is TRUE otherwise just
|
||||||
|
* the state.
|
||||||
*/
|
*/
|
||||||
char * mode_get_display_value ( const Mode *mode, unsigned int selected_line, int *state, GList **attribute_list, int get_entry );
|
char *mode_get_display_value(const Mode *mode, unsigned int selected_line,
|
||||||
|
int *state, GList **attribute_list, int get_entry);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -136,17 +138,19 @@ char * mode_get_display_value ( const Mode *mode, unsigned int selected_line, in
|
||||||
*
|
*
|
||||||
* @returns allocated new cairo_surface_t if applicable
|
* @returns allocated new cairo_surface_t if applicable
|
||||||
*/
|
*/
|
||||||
cairo_surface_t * mode_get_icon ( const Mode *mode, unsigned int selected_line, int height );
|
cairo_surface_t *mode_get_icon(const Mode *mode, unsigned int selected_line,
|
||||||
|
int height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
* @param selected_line The entry to query
|
* @param selected_line The entry to query
|
||||||
*
|
*
|
||||||
* Return a string that can be used for completion. It has should have no markup.
|
* Return a string that can be used for completion. It has should have no
|
||||||
|
* markup.
|
||||||
*
|
*
|
||||||
* @returns allocated string.
|
* @returns allocated string.
|
||||||
*/
|
*/
|
||||||
char * mode_get_completion ( const Mode *mode, unsigned int selected_line );
|
char *mode_get_completion(const Mode *mode, unsigned int selected_line);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -158,7 +162,8 @@ char * mode_get_completion ( const Mode *mode, unsigned int selected_line );
|
||||||
*
|
*
|
||||||
* @returns the next #ModeMode.
|
* @returns the next #ModeMode.
|
||||||
*/
|
*/
|
||||||
ModeMode mode_result ( Mode *mode, int menu_retv, char **input, unsigned int selected_line );
|
ModeMode mode_result(Mode *mode, int menu_retv, char **input,
|
||||||
|
unsigned int selected_line);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -169,7 +174,8 @@ ModeMode mode_result ( Mode *mode, int menu_retv, char **input, unsigned int sel
|
||||||
*
|
*
|
||||||
* @returns TRUE if matches
|
* @returns TRUE if matches
|
||||||
*/
|
*/
|
||||||
int mode_token_match ( const Mode *mode, rofi_int_matcher **tokens, unsigned int selected_line );
|
int mode_token_match(const Mode *mode, rofi_int_matcher **tokens,
|
||||||
|
unsigned int selected_line);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -178,14 +184,14 @@ int mode_token_match ( const Mode *mode, rofi_int_matcher **tokens, unsigned int
|
||||||
*
|
*
|
||||||
* @returns the name of the mode.
|
* @returns the name of the mode.
|
||||||
*/
|
*/
|
||||||
const char * mode_get_name ( const Mode *mode );
|
const char *mode_get_name(const Mode *mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
*
|
*
|
||||||
* Free the resources allocated for this mode.
|
* Free the resources allocated for this mode.
|
||||||
*/
|
*/
|
||||||
void mode_free ( Mode **mode );
|
void mode_free(Mode **mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -193,7 +199,7 @@ void mode_free ( Mode **mode );
|
||||||
* Helper functions for mode.
|
* Helper functions for mode.
|
||||||
* Get the private data object.
|
* Get the private data object.
|
||||||
*/
|
*/
|
||||||
void *mode_get_private_data ( const Mode *mode );
|
void *mode_get_private_data(const Mode *mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -202,7 +208,7 @@ void *mode_get_private_data ( const Mode *mode );
|
||||||
* Helper functions for mode.
|
* Helper functions for mode.
|
||||||
* Set the private data object.
|
* Set the private data object.
|
||||||
*/
|
*/
|
||||||
void mode_set_private_data ( Mode *mode, void *pd );
|
void mode_set_private_data(Mode *mode, void *pd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -211,14 +217,15 @@ void mode_set_private_data ( Mode *mode, void *pd );
|
||||||
*
|
*
|
||||||
* @return the user visible name of the mode
|
* @return the user visible name of the mode
|
||||||
*/
|
*/
|
||||||
const char *mode_get_display_name ( const Mode *mode );
|
const char *mode_get_display_name(const Mode *mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
*
|
*
|
||||||
* Should be called once for each mode. This adds the display-name configuration option for the mode.
|
* Should be called once for each mode. This adds the display-name configuration
|
||||||
|
* option for the mode.
|
||||||
*/
|
*/
|
||||||
void mode_set_config ( Mode *mode );
|
void mode_set_config(Mode *mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
|
@ -229,16 +236,17 @@ void mode_set_config ( Mode *mode );
|
||||||
*
|
*
|
||||||
* @returns a newly allocated string
|
* @returns a newly allocated string
|
||||||
*/
|
*/
|
||||||
char * mode_preprocess_input ( Mode *mode, const char *input );
|
char *mode_preprocess_input(Mode *mode, const char *input);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param mode The mode to query
|
* @param mode The mode to query
|
||||||
*
|
*
|
||||||
* Query the mode for a user display.
|
* Query the mode for a user display.
|
||||||
*
|
*
|
||||||
* @return a new allocated (valid pango markup) message to display (user should free).
|
* @return a new allocated (valid pango markup) message to display (user should
|
||||||
|
* free).
|
||||||
*/
|
*/
|
||||||
char *mode_get_message ( const Mode *mode );
|
char *mode_get_message(const Mode *mode);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#ifndef ROFI_ICON_FETCHER_H
|
#ifndef ROFI_ICON_FETCHER_H
|
||||||
#define ROFI_ICON_FETCHER_H
|
#define ROFI_ICON_FETCHER_H
|
||||||
|
|
||||||
|
#include <cairo.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cairo.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup ICONFETCHER IconFetcher
|
* @defgroup ICONFETCHER IconFetcher
|
||||||
|
@ -16,25 +16,26 @@
|
||||||
/**
|
/**
|
||||||
* Initialize the icon fetcher.
|
* Initialize the icon fetcher.
|
||||||
*/
|
*/
|
||||||
void rofi_icon_fetcher_init ( void );
|
void rofi_icon_fetcher_init(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy and free the memory used by the icon fetcher.
|
* Destroy and free the memory used by the icon fetcher.
|
||||||
*/
|
*/
|
||||||
void rofi_icon_fetcher_destroy ( void );
|
void rofi_icon_fetcher_destroy(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name The name of the icon to fetch.
|
* @param name The name of the icon to fetch.
|
||||||
* @param size The size of the icon to fetch.
|
* @param size The size of the icon to fetch.
|
||||||
*
|
*
|
||||||
* Query the icon-theme for icon with name and size.
|
* Query the icon-theme for icon with name and size.
|
||||||
* The returned icon will be the best match for the requested size, it should still be resized to the actual size.
|
* The returned icon will be the best match for the requested size, it should
|
||||||
|
* still be resized to the actual size.
|
||||||
*
|
*
|
||||||
* name can also be a full path, if prefixed with file://.
|
* name can also be a full path, if prefixed with file://.
|
||||||
*
|
*
|
||||||
* @returns the uid identifying the request.
|
* @returns the uid identifying the request.
|
||||||
*/
|
*/
|
||||||
uint32_t rofi_icon_fetcher_query ( const char *name, const int size );
|
uint32_t rofi_icon_fetcher_query(const char *name, const int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name The name of the icon to fetch.
|
* @param name The name of the icon to fetch.
|
||||||
|
@ -42,14 +43,16 @@ uint32_t rofi_icon_fetcher_query ( const char *name, const int size );
|
||||||
* @param hsize The height of the icon to fetch.
|
* @param hsize The height of the icon to fetch.
|
||||||
*
|
*
|
||||||
* Query the icon-theme for icon with name and size.
|
* Query the icon-theme for icon with name and size.
|
||||||
* The returned icon will be the best match for the requested size, it should still be resized to the actual size.
|
* The returned icon will be the best match for the requested size, it should
|
||||||
* For icons it will take the min of wsize and hsize.
|
* still be resized to the actual size. For icons it will take the min of wsize
|
||||||
|
* and hsize.
|
||||||
*
|
*
|
||||||
* name can also be a full path, if prefixed with file://.
|
* name can also be a full path, if prefixed with file://.
|
||||||
*
|
*
|
||||||
* @returns the uid identifying the request.
|
* @returns the uid identifying the request.
|
||||||
*/
|
*/
|
||||||
uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, const int hsize );
|
uint32_t rofi_icon_fetcher_query_advanced(const char *name, const int wsize,
|
||||||
|
const int hsize);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param uid The unique id representing the matching request.
|
* @param uid The unique id representing the matching request.
|
||||||
|
@ -58,7 +61,7 @@ uint32_t rofi_icon_fetcher_query_advanced ( const char *name, const int wsize, c
|
||||||
*
|
*
|
||||||
* @returns the surface with the icon, NULL when not found.
|
* @returns the surface with the icon, NULL when not found.
|
||||||
*/
|
*/
|
||||||
cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid );
|
cairo_surface_t *rofi_icon_fetcher_get(const uint32_t uid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param path the image path to check.
|
* @param path the image path to check.
|
||||||
|
@ -67,6 +70,6 @@ cairo_surface_t * rofi_icon_fetcher_get ( const uint32_t uid );
|
||||||
*
|
*
|
||||||
* @returns true if image, false otherwise.
|
* @returns true if image, false otherwise.
|
||||||
*/
|
*/
|
||||||
gboolean rofi_icon_fetcher_file_is_image ( const char * const path );
|
gboolean rofi_icon_fetcher_file_is_image(const char *const path);
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif // ROFI_ICON_FETCHER_H
|
#endif // ROFI_ICON_FETCHER_H
|
||||||
|
|
|
@ -27,15 +27,15 @@
|
||||||
|
|
||||||
#ifndef ROFI_MAIN_H
|
#ifndef ROFI_MAIN_H
|
||||||
#define ROFI_MAIN_H
|
#define ROFI_MAIN_H
|
||||||
#include <xcb/xcb.h>
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
|
||||||
#include <glib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "rofi-types.h"
|
|
||||||
#include "keyb.h"
|
#include "keyb.h"
|
||||||
#include "mode.h"
|
#include "mode.h"
|
||||||
|
#include "rofi-types.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
#include <glib.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Main Main
|
* @defgroup Main Main
|
||||||
|
@ -52,41 +52,42 @@ extern const char *cache_dir;
|
||||||
*
|
*
|
||||||
* @returns the number of enabled modi.
|
* @returns the number of enabled modi.
|
||||||
*/
|
*/
|
||||||
unsigned int rofi_get_num_enabled_modi ( void );
|
unsigned int rofi_get_num_enabled_modi(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param index The mode to return. (should be smaller then rofi_get_num_enabled_mode)
|
* @param index The mode to return. (should be smaller then
|
||||||
|
* rofi_get_num_enabled_mode)
|
||||||
*
|
*
|
||||||
* Get an enabled mode handle.
|
* Get an enabled mode handle.
|
||||||
*
|
*
|
||||||
* @returns a Mode handle.
|
* @returns a Mode handle.
|
||||||
*/
|
*/
|
||||||
const Mode * rofi_get_mode ( unsigned int index );
|
const Mode *rofi_get_mode(unsigned int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param str A GString with an error message to display.
|
* @param str A GString with an error message to display.
|
||||||
*
|
*
|
||||||
* Queue an error.
|
* Queue an error.
|
||||||
*/
|
*/
|
||||||
void rofi_add_error_message ( GString *str );
|
void rofi_add_error_message(GString *str);
|
||||||
|
|
||||||
void rofi_clear_error_messages ( void );
|
void rofi_clear_error_messages(void);
|
||||||
/**
|
/**
|
||||||
* @param code the code to return
|
* @param code the code to return
|
||||||
*
|
*
|
||||||
* Return value are used for integrating dmenu rofi in scripts.
|
* Return value are used for integrating dmenu rofi in scripts.
|
||||||
* This function sets the code that rofi will return on exit.
|
* This function sets the code that rofi will return on exit.
|
||||||
*/
|
*/
|
||||||
void rofi_set_return_code ( int code );
|
void rofi_set_return_code(int code);
|
||||||
|
|
||||||
void rofi_quit_main_loop ( void );
|
void rofi_quit_main_loop(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name Search for mode with this name.
|
* @param name Search for mode with this name.
|
||||||
*
|
*
|
||||||
* @return returns Mode * when found, NULL if not.
|
* @return returns Mode * when found, NULL if not.
|
||||||
*/
|
*/
|
||||||
Mode * rofi_collect_modi_search ( const char *name );
|
Mode *rofi_collect_modi_search(const char *name);
|
||||||
/** Reset terminal */
|
/** Reset terminal */
|
||||||
#define color_reset "\033[0m"
|
#define color_reset "\033[0m"
|
||||||
/** Set terminal text bold */
|
/** Set terminal text bold */
|
||||||
|
@ -99,7 +100,8 @@ Mode * rofi_collect_modi_search ( const char *name );
|
||||||
#define color_red "\033[0;31m"
|
#define color_red "\033[0;31m"
|
||||||
|
|
||||||
/** Appends instructions on how to report an error. */
|
/** Appends instructions on how to report an error. */
|
||||||
#define ERROR_MSG( a ) a "\n" \
|
#define ERROR_MSG(a) \
|
||||||
|
a "\n" \
|
||||||
"If you suspect this is caused by a bug in rofi,\n" \
|
"If you suspect this is caused by a bug in rofi,\n" \
|
||||||
"please report the following information to rofi's github page:\n" \
|
"please report the following information to rofi's github page:\n" \
|
||||||
" * The generated commandline output when the error occurred.\n" \
|
" * The generated commandline output when the error occurred.\n" \
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
*
|
*
|
||||||
* @ingroup CONFIGURATION
|
* @ingroup CONFIGURATION
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
MM_NORMAL = 0,
|
MM_NORMAL = 0,
|
||||||
MM_REGEX = 1,
|
MM_REGEX = 1,
|
||||||
MM_GLOB = 2,
|
MM_GLOB = 2,
|
||||||
|
@ -47,44 +46,39 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* Possible sorting methods for listview.
|
* Possible sorting methods for listview.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum { SORT_NORMAL = 0, SORT_FZF = 1 } SortingMethod;
|
||||||
{
|
|
||||||
SORT_NORMAL = 0,
|
|
||||||
SORT_FZF = 1
|
|
||||||
} SortingMethod;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings structure holding all (static) configurable options.
|
* Settings structure holding all (static) configurable options.
|
||||||
* @ingroup CONFIGURATION
|
* @ingroup CONFIGURATION
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
/** List of enabled modi */
|
/** List of enabled modi */
|
||||||
char *modi;
|
char *modi;
|
||||||
/** Font string (pango format) */
|
/** Font string (pango format) */
|
||||||
char * menu_font;
|
char *menu_font;
|
||||||
|
|
||||||
/** Whether to load and show icons */
|
/** Whether to load and show icons */
|
||||||
gboolean show_icons;
|
gboolean show_icons;
|
||||||
|
|
||||||
/** Terminal to use */
|
/** Terminal to use */
|
||||||
char * terminal_emulator;
|
char *terminal_emulator;
|
||||||
/** SSH client to use */
|
/** SSH client to use */
|
||||||
char * ssh_client;
|
char *ssh_client;
|
||||||
/** Command to execute when ssh session is selected */
|
/** Command to execute when ssh session is selected */
|
||||||
char * ssh_command;
|
char *ssh_command;
|
||||||
/** Command for executing an application */
|
/** Command for executing an application */
|
||||||
char * run_command;
|
char *run_command;
|
||||||
/** Command for executing an application in a terminal */
|
/** Command for executing an application in a terminal */
|
||||||
char * run_shell_command;
|
char *run_shell_command;
|
||||||
/** Command for listing executables */
|
/** Command for listing executables */
|
||||||
char * run_list_command;
|
char *run_list_command;
|
||||||
/** Command for window */
|
/** Command for window */
|
||||||
char * window_command;
|
char *window_command;
|
||||||
/** Window fields to match in window mode */
|
/** Window fields to match in window mode */
|
||||||
char * window_match_fields;
|
char *window_match_fields;
|
||||||
/** Theme for icons */
|
/** Theme for icons */
|
||||||
char * icon_theme;
|
char *icon_theme;
|
||||||
|
|
||||||
/** Windows location/gravity */
|
/** Windows location/gravity */
|
||||||
WindowLocation location;
|
WindowLocation location;
|
||||||
|
@ -97,24 +91,24 @@ typedef struct
|
||||||
/** Do not use history */
|
/** Do not use history */
|
||||||
unsigned int disable_history;
|
unsigned int disable_history;
|
||||||
/** Programs ignored for history */
|
/** Programs ignored for history */
|
||||||
char * ignored_prefixes;
|
char *ignored_prefixes;
|
||||||
/** Toggle to enable sorting. */
|
/** Toggle to enable sorting. */
|
||||||
unsigned int sort;
|
unsigned int sort;
|
||||||
/** Sorting method. */
|
/** Sorting method. */
|
||||||
SortingMethod sorting_method_enum;
|
SortingMethod sorting_method_enum;
|
||||||
/** Sorting method. */
|
/** Sorting method. */
|
||||||
char * sorting_method;
|
char *sorting_method;
|
||||||
|
|
||||||
/** Desktop entries to match in drun */
|
/** Desktop entries to match in drun */
|
||||||
char * drun_match_fields;
|
char *drun_match_fields;
|
||||||
/** Only show entries in this category */
|
/** Only show entries in this category */
|
||||||
char * drun_categories;
|
char *drun_categories;
|
||||||
/** Desktop entry show actions */
|
/** Desktop entry show actions */
|
||||||
unsigned int drun_show_actions;
|
unsigned int drun_show_actions;
|
||||||
/** Desktop format display */
|
/** Desktop format display */
|
||||||
char * drun_display_format;
|
char *drun_display_format;
|
||||||
/** Desktop Link launch command */
|
/** Desktop Link launch command */
|
||||||
char * drun_url_launcher;
|
char *drun_url_launcher;
|
||||||
|
|
||||||
/** Search case sensitivity */
|
/** Search case sensitivity */
|
||||||
unsigned int case_sensitive;
|
unsigned int case_sensitive;
|
||||||
|
@ -155,7 +149,7 @@ typedef struct
|
||||||
|
|
||||||
char *theme;
|
char *theme;
|
||||||
/** Path where plugins can be found. */
|
/** Path where plugins can be found. */
|
||||||
char * plugin_path;
|
char *plugin_path;
|
||||||
|
|
||||||
/** Maximum history length per mode. */
|
/** Maximum history length per mode. */
|
||||||
unsigned int max_history_size;
|
unsigned int max_history_size;
|
||||||
|
|
120
include/theme.h
120
include/theme.h
|
@ -27,16 +27,15 @@
|
||||||
|
|
||||||
#ifndef THEME_H
|
#ifndef THEME_H
|
||||||
#define THEME_H
|
#define THEME_H
|
||||||
#include <glib.h>
|
|
||||||
#include <cairo.h>
|
|
||||||
#include <widgets/widget.h>
|
|
||||||
#include "rofi-types.h"
|
#include "rofi-types.h"
|
||||||
|
#include <cairo.h>
|
||||||
|
#include <glib.h>
|
||||||
|
#include <widgets/widget.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Describe the media constraint type.
|
* Describe the media constraint type.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Minimum width constraint. */
|
/** Minimum width constraint. */
|
||||||
THEME_MEDIA_TYPE_MIN_WIDTH,
|
THEME_MEDIA_TYPE_MIN_WIDTH,
|
||||||
/** Maximum width constraint. */
|
/** Maximum width constraint. */
|
||||||
|
@ -58,8 +57,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* Theme Media description.
|
* Theme Media description.
|
||||||
*/
|
*/
|
||||||
typedef struct ThemeMedia
|
typedef struct ThemeMedia {
|
||||||
{
|
|
||||||
ThemeMediaType type;
|
ThemeMediaType type;
|
||||||
double value;
|
double value;
|
||||||
} ThemeMedia;
|
} ThemeMedia;
|
||||||
|
@ -67,8 +65,7 @@ typedef struct ThemeMedia
|
||||||
/**
|
/**
|
||||||
* ThemeWidget.
|
* ThemeWidget.
|
||||||
*/
|
*/
|
||||||
typedef struct ThemeWidget
|
typedef struct ThemeWidget {
|
||||||
{
|
|
||||||
int set;
|
int set;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
|
@ -102,15 +99,16 @@ extern ThemeWidget *rofi_configuration;
|
||||||
*
|
*
|
||||||
* @returns handle to the new entry.
|
* @returns handle to the new entry.
|
||||||
*/
|
*/
|
||||||
ThemeWidget *rofi_theme_find_or_create_name ( ThemeWidget *base, const char *name );
|
ThemeWidget *rofi_theme_find_or_create_name(ThemeWidget *base,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle.
|
* @param widget The widget handle.
|
||||||
*
|
*
|
||||||
* Print out the widget to the commandline.
|
* Print out the widget to the commandline.
|
||||||
*/
|
*/
|
||||||
void rofi_theme_print ( ThemeWidget *widget );
|
void rofi_theme_print(ThemeWidget *widget);
|
||||||
void rofi_theme_print_index ( ThemeWidget *widget, int index );
|
void rofi_theme_print_index(ThemeWidget *widget, int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type The type of the property to create.
|
* @param type The type of the property to create.
|
||||||
|
@ -119,27 +117,27 @@ void rofi_theme_print_index ( ThemeWidget *widget, int index );
|
||||||
*
|
*
|
||||||
* @returns a new property.
|
* @returns a new property.
|
||||||
*/
|
*/
|
||||||
Property *rofi_theme_property_create ( PropertyType type );
|
Property *rofi_theme_property_create(PropertyType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param p The property to free.
|
* @param p The property to free.
|
||||||
*
|
*
|
||||||
* Free the content of the property.
|
* Free the content of the property.
|
||||||
*/
|
*/
|
||||||
void rofi_theme_property_free ( Property *p );
|
void rofi_theme_property_free(Property *p);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param p The property to free.
|
* @param p The property to free.
|
||||||
*
|
*
|
||||||
* @returns a copy of p
|
* @returns a copy of p
|
||||||
*/
|
*/
|
||||||
Property* rofi_theme_property_copy ( const Property *p );
|
Property *rofi_theme_property_copy(const Property *p);
|
||||||
/**
|
/**
|
||||||
* @param widget
|
* @param widget
|
||||||
*
|
*
|
||||||
* Free the widget and alll children.
|
* Free the widget and alll children.
|
||||||
*/
|
*/
|
||||||
void rofi_theme_free ( ThemeWidget *widget );
|
void rofi_theme_free(ThemeWidget *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param file filename to parse.
|
* @param file filename to parse.
|
||||||
|
@ -148,7 +146,7 @@ void rofi_theme_free ( ThemeWidget *widget );
|
||||||
*
|
*
|
||||||
* @returns returns TRUE when error.
|
* @returns returns TRUE when error.
|
||||||
*/
|
*/
|
||||||
gboolean rofi_theme_parse_file ( const char *file );
|
gboolean rofi_theme_parse_file(const char *file);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string to parse.
|
* @param string to parse.
|
||||||
|
@ -157,7 +155,7 @@ gboolean rofi_theme_parse_file ( const char *file );
|
||||||
*
|
*
|
||||||
* @returns returns TRUE when error.
|
* @returns returns TRUE when error.
|
||||||
*/
|
*/
|
||||||
gboolean rofi_theme_parse_string ( const char *string );
|
gboolean rofi_theme_parse_string(const char *string);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle.
|
* @param widget The widget handle.
|
||||||
|
@ -165,7 +163,7 @@ gboolean rofi_theme_parse_string ( const char *string );
|
||||||
*
|
*
|
||||||
* Merge properties with widgets current property.
|
* Merge properties with widgets current property.
|
||||||
*/
|
*/
|
||||||
void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table );
|
void rofi_theme_widget_add_properties(ThemeWidget *widget, GHashTable *table);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public API
|
* Public API
|
||||||
|
@ -180,7 +178,8 @@ void rofi_theme_widget_add_properties ( ThemeWidget *widget, GHashTable *table )
|
||||||
*
|
*
|
||||||
* @returns The distance value of this property for this widget.
|
* @returns The distance value of this property for this widget.
|
||||||
*/
|
*/
|
||||||
RofiDistance rofi_theme_get_distance ( const widget *widget, const char *property, int def );
|
RofiDistance rofi_theme_get_distance(const widget *widget, const char *property,
|
||||||
|
int def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -191,7 +190,7 @@ RofiDistance rofi_theme_get_distance ( const widget *widget, const char *propert
|
||||||
*
|
*
|
||||||
* @returns The integer value of this property for this widget.
|
* @returns The integer value of this property for this widget.
|
||||||
*/
|
*/
|
||||||
int rofi_theme_get_integer ( const widget *widget, const char *property, int def );
|
int rofi_theme_get_integer(const widget *widget, const char *property, int def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -202,7 +201,8 @@ int rofi_theme_get_integer ( const widget *widget, const char *property, int def
|
||||||
*
|
*
|
||||||
* @returns The position value of this property for this widget.
|
* @returns The position value of this property for this widget.
|
||||||
*/
|
*/
|
||||||
int rofi_theme_get_position ( const widget *widget, const char *property, int def );
|
int rofi_theme_get_position(const widget *widget, const char *property,
|
||||||
|
int def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -213,7 +213,7 @@ int rofi_theme_get_position ( const widget *widget, const char *property, int de
|
||||||
*
|
*
|
||||||
* @returns The boolean value of this property for this widget.
|
* @returns The boolean value of this property for this widget.
|
||||||
*/
|
*/
|
||||||
int rofi_theme_get_boolean ( const widget *widget, const char *property, int def );
|
int rofi_theme_get_boolean(const widget *widget, const char *property, int def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -224,7 +224,9 @@ int rofi_theme_get_boolean ( const widget *widget, const char *property, int def
|
||||||
*
|
*
|
||||||
* @returns The orientation of this property for this widget or %def not found.
|
* @returns The orientation of this property for this widget or %def not found.
|
||||||
*/
|
*/
|
||||||
RofiOrientation rofi_theme_get_orientation ( const widget *widget, const char *property, RofiOrientation def );
|
RofiOrientation rofi_theme_get_orientation(const widget *widget,
|
||||||
|
const char *property,
|
||||||
|
RofiOrientation def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -235,7 +237,9 @@ RofiOrientation rofi_theme_get_orientation ( const widget *widget, const char *p
|
||||||
*
|
*
|
||||||
* @returns The cursor for this widget or %def if not found.
|
* @returns The cursor for this widget or %def if not found.
|
||||||
*/
|
*/
|
||||||
RofiCursorType rofi_theme_get_cursor_type ( const widget *widget, const char *property, RofiCursorType def );
|
RofiCursorType rofi_theme_get_cursor_type(const widget *widget,
|
||||||
|
const char *property,
|
||||||
|
RofiCursorType def);
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
* @param property The property to query.
|
* @param property The property to query.
|
||||||
|
@ -245,7 +249,8 @@ RofiCursorType rofi_theme_get_cursor_type ( const widget *widget, const char *pr
|
||||||
*
|
*
|
||||||
* @returns The string value of this property for this widget.
|
* @returns The string value of this property for this widget.
|
||||||
*/
|
*/
|
||||||
const char *rofi_theme_get_string ( const widget *widget, const char *property, const char *def );
|
const char *rofi_theme_get_string(const widget *widget, const char *property,
|
||||||
|
const char *def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -256,7 +261,8 @@ const char *rofi_theme_get_string ( const widget *widget, const char *property,
|
||||||
*
|
*
|
||||||
* @returns The double value of this property for this widget.
|
* @returns The double value of this property for this widget.
|
||||||
*/
|
*/
|
||||||
double rofi_theme_get_double ( const widget *widget, const char *property, double def );
|
double rofi_theme_get_double(const widget *widget, const char *property,
|
||||||
|
double def);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -266,7 +272,8 @@ double rofi_theme_get_double ( const widget *widget, const char *property, doubl
|
||||||
* Obtain the color of the widget and applies this to the drawable d.
|
* Obtain the color of the widget and applies this to the drawable d.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t *d );
|
void rofi_theme_get_color(const widget *widget, const char *property,
|
||||||
|
cairo_t *d);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -277,7 +284,8 @@ void rofi_theme_get_color ( const widget *widget, const char *property, cairo_t
|
||||||
*
|
*
|
||||||
* @return true if image is set.
|
* @return true if image is set.
|
||||||
*/
|
*/
|
||||||
gboolean rofi_theme_get_image ( const widget *widget, const char *property, cairo_t *d );
|
gboolean rofi_theme_get_image(const widget *widget, const char *property,
|
||||||
|
cairo_t *d);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -286,7 +294,7 @@ gboolean rofi_theme_get_image ( const widget *widget, const char *property, cair
|
||||||
* Check if a rofi theme has a property set.
|
* Check if a rofi theme has a property set.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
gboolean rofi_theme_has_property ( const widget *widget, const char *property );
|
gboolean rofi_theme_has_property(const widget *widget, const char *property);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -297,7 +305,8 @@ gboolean rofi_theme_has_property ( const widget *widget, const char *property );
|
||||||
*
|
*
|
||||||
* @returns The padding of this property for this widget.
|
* @returns The padding of this property for this widget.
|
||||||
*/
|
*/
|
||||||
RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property, RofiPadding pad );
|
RofiPadding rofi_theme_get_padding(const widget *widget, const char *property,
|
||||||
|
RofiPadding pad);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -308,7 +317,9 @@ RofiPadding rofi_theme_get_padding ( const widget *widget, const char *property,
|
||||||
*
|
*
|
||||||
* @returns The highlight of this property for this widget.
|
* @returns The highlight of this property for this widget.
|
||||||
*/
|
*/
|
||||||
RofiHighlightColorStyle rofi_theme_get_highlight ( widget *widget, const char *property, RofiHighlightColorStyle th );
|
RofiHighlightColorStyle rofi_theme_get_highlight(widget *widget,
|
||||||
|
const char *property,
|
||||||
|
RofiHighlightColorStyle th);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param d The distance handle.
|
* @param d The distance handle.
|
||||||
|
@ -317,14 +328,14 @@ RofiHighlightColorStyle rofi_theme_get_highlight ( widget *widget, const char *p
|
||||||
* Convert RofiDistance into pixels.
|
* Convert RofiDistance into pixels.
|
||||||
* @returns the number of pixels this distance represents.
|
* @returns the number of pixels this distance represents.
|
||||||
*/
|
*/
|
||||||
int distance_get_pixel ( RofiDistance d, RofiOrientation ori );
|
int distance_get_pixel(RofiDistance d, RofiOrientation ori);
|
||||||
/**
|
/**
|
||||||
* @param d The distance handle.
|
* @param d The distance handle.
|
||||||
* @param draw The cairo drawable.
|
* @param draw The cairo drawable.
|
||||||
*
|
*
|
||||||
* Set linestyle.
|
* Set linestyle.
|
||||||
*/
|
*/
|
||||||
void distance_get_linestyle ( RofiDistance d, cairo_t *draw );
|
void distance_get_linestyle(RofiDistance d, cairo_t *draw);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Low-level functions.
|
* Low-level functions.
|
||||||
|
@ -335,24 +346,30 @@ void distance_get_linestyle ( RofiDistance d, cairo_t *draw );
|
||||||
* @param state The state of the element.
|
* @param state The state of the element.
|
||||||
* @param exact If the match should be exact, or parent can be included.
|
* @param exact If the match should be exact, or parent can be included.
|
||||||
*
|
*
|
||||||
* Find the theme element. If not exact, the closest specified element is returned.
|
* Find the theme element. If not exact, the closest specified element is
|
||||||
|
* returned.
|
||||||
*
|
*
|
||||||
* @returns the ThemeWidget if found, otherwise NULL.
|
* @returns the ThemeWidget if found, otherwise NULL.
|
||||||
*/
|
*/
|
||||||
ThemeWidget *rofi_theme_find_widget ( const char *name, const char *state, gboolean exact );
|
ThemeWidget *rofi_theme_find_widget(const char *name, const char *state,
|
||||||
ThemeWidget *rofi_config_find_widget ( const char *name, const char *state, gboolean exact );
|
gboolean exact);
|
||||||
|
ThemeWidget *rofi_config_find_widget(const char *name, const char *state,
|
||||||
|
gboolean exact);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to find the property on.
|
* @param widget The widget to find the property on.
|
||||||
* @param type The %PropertyType to find.
|
* @param type The %PropertyType to find.
|
||||||
* @param property The property to find.
|
* @param property The property to find.
|
||||||
* @param exact If the property should only be found on this widget, or on parents if not found.
|
* @param exact If the property should only be found on this widget, or on
|
||||||
|
* parents if not found.
|
||||||
*
|
*
|
||||||
* Find the property on the widget. If not exact, the parents are searched recursively until match is found.
|
* Find the property on the widget. If not exact, the parents are searched
|
||||||
|
* recursively until match is found.
|
||||||
*
|
*
|
||||||
* @returns the Property if found, otherwise NULL.
|
* @returns the Property if found, otherwise NULL.
|
||||||
*/
|
*/
|
||||||
Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, const char *property, gboolean exact );
|
Property *rofi_theme_find_property(ThemeWidget *widget, PropertyType type,
|
||||||
|
const char *property, gboolean exact);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to query
|
* @param widget The widget to query
|
||||||
|
@ -361,20 +378,21 @@ Property *rofi_theme_find_property ( ThemeWidget *widget, PropertyType type, con
|
||||||
*
|
*
|
||||||
* Obtain list of elements (strings) of the widget.
|
* Obtain list of elements (strings) of the widget.
|
||||||
*
|
*
|
||||||
* @returns a GList holding the names in the list of this property for this widget.
|
* @returns a GList holding the names in the list of this property for this
|
||||||
|
* widget.
|
||||||
*/
|
*/
|
||||||
GList *rofi_theme_get_list ( const widget *widget, const char * property, const char *defaults );
|
GList *rofi_theme_get_list(const widget *widget, const char *property,
|
||||||
|
const char *defaults);
|
||||||
/**
|
/**
|
||||||
* Checks if a theme is set, or is empty.
|
* Checks if a theme is set, or is empty.
|
||||||
* @returns TRUE when empty.
|
* @returns TRUE when empty.
|
||||||
*/
|
*/
|
||||||
gboolean rofi_theme_is_empty ( void );
|
gboolean rofi_theme_is_empty(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the current theme.
|
* Reset the current theme.
|
||||||
*/
|
*/
|
||||||
void rofi_theme_reset ( void );
|
void rofi_theme_reset(void);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param file File name to prepare.
|
* @param file File name to prepare.
|
||||||
|
@ -384,12 +402,12 @@ void rofi_theme_reset ( void );
|
||||||
*
|
*
|
||||||
* @returns full path to file.
|
* @returns full path to file.
|
||||||
*/
|
*/
|
||||||
char * rofi_theme_parse_prepare_file ( const char *file, const char *parent_file );
|
char *rofi_theme_parse_prepare_file(const char *file, const char *parent_file);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process conditionals.
|
* Process conditionals.
|
||||||
*/
|
*/
|
||||||
void rofi_theme_parse_process_conditionals ( void );
|
void rofi_theme_parse_process_conditionals(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parent target theme tree
|
* @param parent target theme tree
|
||||||
|
@ -397,27 +415,27 @@ void rofi_theme_parse_process_conditionals ( void );
|
||||||
*
|
*
|
||||||
* Merge all the settings from child into parent.
|
* Merge all the settings from child into parent.
|
||||||
*/
|
*/
|
||||||
void rofi_theme_parse_merge_widgets ( ThemeWidget *parent, ThemeWidget *child );
|
void rofi_theme_parse_merge_widgets(ThemeWidget *parent, ThemeWidget *child);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type the media type to parse.
|
* @param type the media type to parse.
|
||||||
*
|
*
|
||||||
* Returns the media type described by type.
|
* Returns the media type described by type.
|
||||||
*/
|
*/
|
||||||
ThemeMediaType rofi_theme_parse_media_type ( const char *type );
|
ThemeMediaType rofi_theme_parse_media_type(const char *type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param distance The distance object to copy.
|
* @param distance The distance object to copy.
|
||||||
*
|
*
|
||||||
* @returns a copy of the distance.
|
* @returns a copy of the distance.
|
||||||
*/
|
*/
|
||||||
RofiDistance rofi_theme_property_copy_distance ( RofiDistance const distance );
|
RofiDistance rofi_theme_property_copy_distance(RofiDistance const distance);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param filename The file to validate.
|
* @param filename The file to validate.
|
||||||
*
|
*
|
||||||
* @returns the program exit code.
|
* @returns the program exit code.
|
||||||
*/
|
*/
|
||||||
int rofi_theme_rasi_validate ( const char *filename );
|
int rofi_theme_rasi_validate(const char *filename);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,15 +27,16 @@
|
||||||
|
|
||||||
#ifndef ROFI_VIEW_INTERNAL_H
|
#ifndef ROFI_VIEW_INTERNAL_H
|
||||||
#define ROFI_VIEW_INTERNAL_H
|
#define ROFI_VIEW_INTERNAL_H
|
||||||
#include "widgets/container.h"
|
#include "keyb.h"
|
||||||
#include "widgets/widget.h"
|
#include "mode.h"
|
||||||
#include "widgets/textbox.h"
|
#include "theme.h"
|
||||||
#include "widgets/box.h"
|
#include "widgets/box.h"
|
||||||
|
#include "widgets/container.h"
|
||||||
#include "widgets/icon.h"
|
#include "widgets/icon.h"
|
||||||
#include "widgets/listview.h"
|
#include "widgets/listview.h"
|
||||||
#include "keyb.h"
|
#include "widgets/textbox.h"
|
||||||
|
#include "widgets/widget.h"
|
||||||
#include "xcb.h"
|
#include "xcb.h"
|
||||||
#include "theme.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup ViewHandle
|
* @ingroup ViewHandle
|
||||||
|
@ -44,8 +45,7 @@
|
||||||
*/
|
*/
|
||||||
// State of the menu.
|
// State of the menu.
|
||||||
|
|
||||||
struct RofiViewState
|
struct RofiViewState {
|
||||||
{
|
|
||||||
/** #Mode bound to to this view. */
|
/** #Mode bound to to this view. */
|
||||||
Mode *sw;
|
Mode *sw;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ struct RofiViewState
|
||||||
/** Flag indicating if view needs to be reloaded. */
|
/** Flag indicating if view needs to be reloaded. */
|
||||||
int reload;
|
int reload;
|
||||||
/** The function to be called when finalizing this view */
|
/** The function to be called when finalizing this view */
|
||||||
void ( *finalize )( struct RofiViewState *state );
|
void (*finalize)(struct RofiViewState *state);
|
||||||
|
|
||||||
/** Width of the view */
|
/** Width of the view */
|
||||||
int width;
|
int width;
|
||||||
|
@ -126,8 +126,7 @@ struct RofiViewState
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
/** Position and target of the mouse. */
|
/** Position and target of the mouse. */
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
/** X position */
|
/** X position */
|
||||||
int x;
|
int x;
|
||||||
/** Y position */
|
/** Y position */
|
||||||
|
|
|
@ -27,8 +27,9 @@
|
||||||
|
|
||||||
#ifndef ROFI_VIEW_H
|
#ifndef ROFI_VIEW_H
|
||||||
#define ROFI_VIEW_H
|
#define ROFI_VIEW_H
|
||||||
#include "mode.h"
|
|
||||||
|
|
||||||
|
#include "mode.h"
|
||||||
|
#include <xcb/xcb.h>
|
||||||
/**
|
/**
|
||||||
* @defgroup View View
|
* @defgroup View View
|
||||||
*
|
*
|
||||||
|
@ -44,8 +45,7 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
typedef struct RofiViewState RofiViewState;
|
typedef struct RofiViewState RofiViewState;
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Create a menu for entering text */
|
/** Create a menu for entering text */
|
||||||
MENU_NORMAL = 0,
|
MENU_NORMAL = 0,
|
||||||
/** Create a menu for entering passwords */
|
/** Create a menu for entering passwords */
|
||||||
|
@ -68,14 +68,16 @@ typedef enum
|
||||||
*
|
*
|
||||||
* @returns The command issued (see MenuReturn)
|
* @returns The command issued (see MenuReturn)
|
||||||
*/
|
*/
|
||||||
RofiViewState *rofi_view_create ( Mode *sw, const char *input, MenuFlags menu_flags, void ( *finalize )( RofiViewState * ) );
|
RofiViewState *rofi_view_create(Mode *sw, const char *input,
|
||||||
|
MenuFlags menu_flags,
|
||||||
|
void (*finalize)(RofiViewState *));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The Menu Handle
|
* @param state The Menu Handle
|
||||||
*
|
*
|
||||||
* Check if a finalize function is set, and if sets executes it.
|
* Check if a finalize function is set, and if sets executes it.
|
||||||
*/
|
*/
|
||||||
void rofi_view_finalize ( RofiViewState *state );
|
void rofi_view_finalize(RofiViewState *state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state the Menu handle
|
* @param state the Menu handle
|
||||||
|
@ -84,7 +86,7 @@ void rofi_view_finalize ( RofiViewState *state );
|
||||||
*
|
*
|
||||||
* @returns the return value
|
* @returns the return value
|
||||||
*/
|
*/
|
||||||
MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
|
MenuReturn rofi_view_get_return_value(const RofiViewState *state);
|
||||||
/**
|
/**
|
||||||
* @param state the Menu handle
|
* @param state the Menu handle
|
||||||
*
|
*
|
||||||
|
@ -92,14 +94,14 @@ MenuReturn rofi_view_get_return_value ( const RofiViewState *state );
|
||||||
*
|
*
|
||||||
* @return the next position.
|
* @return the next position.
|
||||||
*/
|
*/
|
||||||
unsigned int rofi_view_get_next_position ( const RofiViewState *state );
|
unsigned int rofi_view_get_next_position(const RofiViewState *state);
|
||||||
/**
|
/**
|
||||||
* @param state the Menu handle
|
* @param state the Menu handle
|
||||||
* @param text The text to add to the input box
|
* @param text The text to add to the input box
|
||||||
*
|
*
|
||||||
* Update the state if needed.
|
* Update the state if needed.
|
||||||
*/
|
*/
|
||||||
void rofi_view_handle_text ( RofiViewState *state, char *text );
|
void rofi_view_handle_text(RofiViewState *state, char *text);
|
||||||
/**
|
/**
|
||||||
* @param state the Menu handle
|
* @param state the Menu handle
|
||||||
* @param x The X coordinates of the motion
|
* @param x The X coordinates of the motion
|
||||||
|
@ -108,31 +110,33 @@ void rofi_view_handle_text ( RofiViewState *state, char *text );
|
||||||
*
|
*
|
||||||
* Update the state if needed.
|
* Update the state if needed.
|
||||||
*/
|
*/
|
||||||
void rofi_view_handle_mouse_motion ( RofiViewState *state, gint x, gint y, gboolean find_mouse_target );
|
void rofi_view_handle_mouse_motion(RofiViewState *state, gint x, gint y,
|
||||||
|
gboolean find_mouse_target);
|
||||||
/**
|
/**
|
||||||
* @param state the Menu handle
|
* @param state the Menu handle
|
||||||
*
|
*
|
||||||
* Update the state if needed.
|
* Update the state if needed.
|
||||||
*/
|
*/
|
||||||
void rofi_view_maybe_update ( RofiViewState *state );
|
void rofi_view_maybe_update(RofiViewState *state);
|
||||||
void rofi_view_temp_configure_notify ( RofiViewState *state, xcb_configure_notify_event_t *xce );
|
void rofi_view_temp_configure_notify(RofiViewState *state,
|
||||||
void rofi_view_temp_click_to_exit ( RofiViewState *state, xcb_window_t target );
|
xcb_configure_notify_event_t *xce);
|
||||||
|
void rofi_view_temp_click_to_exit(RofiViewState *state, xcb_window_t target);
|
||||||
/**
|
/**
|
||||||
* Update the state if needed.
|
* Update the state if needed.
|
||||||
*/
|
*/
|
||||||
void rofi_view_frame_callback ( void );
|
void rofi_view_frame_callback(void);
|
||||||
/**
|
/**
|
||||||
* @param state the Menu handle
|
* @param state the Menu handle
|
||||||
*
|
*
|
||||||
* @returns returns if this state is completed.
|
* @returns returns if this state is completed.
|
||||||
*/
|
*/
|
||||||
unsigned int rofi_view_get_completed ( const RofiViewState *state );
|
unsigned int rofi_view_get_completed(const RofiViewState *state);
|
||||||
/**
|
/**
|
||||||
* @param state the Menu handle
|
* @param state the Menu handle
|
||||||
*
|
*
|
||||||
* @returns the raw user input.
|
* @returns the raw user input.
|
||||||
*/
|
*/
|
||||||
const char * rofi_view_get_user_input ( const RofiViewState *state );
|
const char *rofi_view_get_user_input(const RofiViewState *state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The Menu Handle
|
* @param state The Menu Handle
|
||||||
|
@ -140,7 +144,8 @@ const char * rofi_view_get_user_input ( const RofiViewState *state );
|
||||||
*
|
*
|
||||||
* Select a line.
|
* Select a line.
|
||||||
*/
|
*/
|
||||||
void rofi_view_set_selected_line ( RofiViewState *state, unsigned int selected_line );
|
void rofi_view_set_selected_line(RofiViewState *state,
|
||||||
|
unsigned int selected_line);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The Menu Handle
|
* @param state The Menu Handle
|
||||||
|
@ -149,14 +154,14 @@ void rofi_view_set_selected_line ( RofiViewState *state, unsigned int selected_l
|
||||||
*
|
*
|
||||||
* @returns the selected line or UINT32_MAX if none selected.
|
* @returns the selected line or UINT32_MAX if none selected.
|
||||||
*/
|
*/
|
||||||
unsigned int rofi_view_get_selected_line ( const RofiViewState *state );
|
unsigned int rofi_view_get_selected_line(const RofiViewState *state);
|
||||||
/**
|
/**
|
||||||
* @param state The Menu Handle
|
* @param state The Menu Handle
|
||||||
*
|
*
|
||||||
* Restart the menu so it can be displayed again.
|
* Restart the menu so it can be displayed again.
|
||||||
* Resets RofiViewState::quit and RofiViewState::retv.
|
* Resets RofiViewState::quit and RofiViewState::retv.
|
||||||
*/
|
*/
|
||||||
void rofi_view_restart ( RofiViewState *state );
|
void rofi_view_restart(RofiViewState *state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The handle to the view
|
* @param state The handle to the view
|
||||||
|
@ -165,7 +170,8 @@ void rofi_view_restart ( RofiViewState *state );
|
||||||
*
|
*
|
||||||
* @returns TRUE if action was handled.
|
* @returns TRUE if action was handled.
|
||||||
*/
|
*/
|
||||||
gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, guint action );
|
gboolean rofi_view_trigger_action(RofiViewState *state, BindingsScope scope,
|
||||||
|
guint action);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The handle to the view
|
* @param state The handle to the view
|
||||||
|
@ -173,7 +179,7 @@ gboolean rofi_view_trigger_action ( RofiViewState *state, BindingsScope scope, g
|
||||||
* Free's the memory allocated for this handle.
|
* Free's the memory allocated for this handle.
|
||||||
* After a call to this function, state is invalid and can no longer be used.
|
* After a call to this function, state is invalid and can no longer be used.
|
||||||
*/
|
*/
|
||||||
void rofi_view_free ( RofiViewState *state );
|
void rofi_view_free(RofiViewState *state);
|
||||||
/** @} */
|
/** @} */
|
||||||
/**
|
/**
|
||||||
* @defgroup ViewGlobal ViewGlobal
|
* @defgroup ViewGlobal ViewGlobal
|
||||||
|
@ -189,7 +195,7 @@ void rofi_view_free ( RofiViewState *state );
|
||||||
*
|
*
|
||||||
* @returns the active view handle or NULL
|
* @returns the active view handle or NULL
|
||||||
*/
|
*/
|
||||||
RofiViewState * rofi_view_get_active ( void );
|
RofiViewState *rofi_view_get_active(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state the new active view handle.
|
* @param state the new active view handle.
|
||||||
|
@ -199,7 +205,7 @@ RofiViewState * rofi_view_get_active ( void );
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void rofi_view_set_active ( RofiViewState *state );
|
void rofi_view_set_active(RofiViewState *state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state remove view handle.
|
* @param state remove view handle.
|
||||||
|
@ -208,25 +214,25 @@ void rofi_view_set_active ( RofiViewState *state );
|
||||||
* stack.
|
* stack.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void rofi_view_remove_active ( RofiViewState *state );
|
void rofi_view_remove_active(RofiViewState *state);
|
||||||
/**
|
/**
|
||||||
* @param msg The error message to show.
|
* @param msg The error message to show.
|
||||||
* @param markup The error message uses pango markup.
|
* @param markup The error message uses pango markup.
|
||||||
*
|
*
|
||||||
* The error message to show.
|
* The error message to show.
|
||||||
*/
|
*/
|
||||||
int rofi_view_error_dialog ( const char *msg, int markup );
|
int rofi_view_error_dialog(const char *msg, int markup);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queue a redraw.
|
* Queue a redraw.
|
||||||
* This triggers a X11 Expose Event.
|
* This triggers a X11 Expose Event.
|
||||||
*/
|
*/
|
||||||
void rofi_view_queue_redraw ( void );
|
void rofi_view_queue_redraw(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup internal data of the view.
|
* Cleanup internal data of the view.
|
||||||
*/
|
*/
|
||||||
void rofi_view_cleanup ( void );
|
void rofi_view_cleanup(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The handle to the view
|
* @param state The handle to the view
|
||||||
|
@ -235,12 +241,12 @@ void rofi_view_cleanup ( void );
|
||||||
*
|
*
|
||||||
* @returns the mode currently displayed by the view
|
* @returns the mode currently displayed by the view
|
||||||
*/
|
*/
|
||||||
Mode * rofi_view_get_mode ( RofiViewState *state );
|
Mode *rofi_view_get_mode(RofiViewState *state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unmap the current view.
|
* Unmap the current view.
|
||||||
*/
|
*/
|
||||||
void rofi_view_hide ( void );
|
void rofi_view_hide(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicate the current view needs to reload its data.
|
* Indicate the current view needs to reload its data.
|
||||||
|
@ -248,7 +254,7 @@ void rofi_view_hide ( void );
|
||||||
*
|
*
|
||||||
* The reloading happens 'lazy', multiple calls might be handled at once.
|
* The reloading happens 'lazy', multiple calls might be handled at once.
|
||||||
*/
|
*/
|
||||||
void rofi_view_reload ( void );
|
void rofi_view_reload(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The handle to the view
|
* @param state The handle to the view
|
||||||
|
@ -256,7 +262,7 @@ void rofi_view_reload ( void );
|
||||||
*
|
*
|
||||||
* Change the current view to show a different mode.
|
* Change the current view to show a different mode.
|
||||||
*/
|
*/
|
||||||
void rofi_view_switch_mode ( RofiViewState *state, Mode *mode );
|
void rofi_view_switch_mode(RofiViewState *state, Mode *mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The handle to the view
|
* @param state The handle to the view
|
||||||
|
@ -264,14 +270,14 @@ void rofi_view_switch_mode ( RofiViewState *state, Mode *mode );
|
||||||
*
|
*
|
||||||
* Overlays text over the current view. Passing NULL for text hides the overlay.
|
* Overlays text over the current view. Passing NULL for text hides the overlay.
|
||||||
*/
|
*/
|
||||||
void rofi_view_set_overlay ( RofiViewState *state, const char *text );
|
void rofi_view_set_overlay(RofiViewState *state, const char *text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state The handle to the view.
|
* @param state The handle to the view.
|
||||||
*
|
*
|
||||||
* Clears the user entry box, set selected to 0.
|
* Clears the user entry box, set selected to 0.
|
||||||
*/
|
*/
|
||||||
void rofi_view_clear_input ( RofiViewState *state );
|
void rofi_view_clear_input(RofiViewState *state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param menu_flags The state of the new window.
|
* @param menu_flags The state of the new window.
|
||||||
|
@ -279,33 +285,33 @@ void rofi_view_clear_input ( RofiViewState *state );
|
||||||
* Creates the internal 'Cached' window that gets reused between views.
|
* Creates the internal 'Cached' window that gets reused between views.
|
||||||
* TODO: Internal call to view exposed.
|
* TODO: Internal call to view exposed.
|
||||||
*/
|
*/
|
||||||
void __create_window ( MenuFlags menu_flags );
|
void __create_window(MenuFlags menu_flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the handle of the main window.
|
* Get the handle of the main window.
|
||||||
*
|
*
|
||||||
* @returns the xcb_window_t for rofi's view or XCB_WINDOW_NONE.
|
* @returns the xcb_window_t for rofi's view or XCB_WINDOW_NONE.
|
||||||
*/
|
*/
|
||||||
xcb_window_t rofi_view_get_window ( void );
|
xcb_window_t rofi_view_get_window(void);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* @defgroup ViewThreadPool ViewThreadPool
|
* @defgroup ViewThreadPool ViewThreadPool
|
||||||
* @ingroup View
|
* @ingroup View
|
||||||
*
|
*
|
||||||
* The view can (optionally) keep a set of worker threads around to parallize work.
|
* The view can (optionally) keep a set of worker threads around to parallize
|
||||||
* This includes filtering and sorting.
|
* work. This includes filtering and sorting.
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* Initialize the threadpool
|
* Initialize the threadpool
|
||||||
*/
|
*/
|
||||||
void rofi_view_workers_initialize ( void );
|
void rofi_view_workers_initialize(void);
|
||||||
/**
|
/**
|
||||||
* Stop all threads and free the resources used by the threadpool
|
* Stop all threads and free the resources used by the threadpool
|
||||||
*/
|
*/
|
||||||
void rofi_view_workers_finalize ( void );
|
void rofi_view_workers_finalize(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param width the width of the monitor.
|
* @param width the width of the monitor.
|
||||||
|
@ -314,20 +320,20 @@ void rofi_view_workers_finalize ( void );
|
||||||
* Return the current monitor workarea.
|
* Return the current monitor workarea.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void rofi_view_get_current_monitor ( int *width, int *height );
|
void rofi_view_get_current_monitor(int *width, int *height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes a screenshot.
|
* Takes a screenshot.
|
||||||
*/
|
*/
|
||||||
void rofi_capture_screenshot ( void );
|
void rofi_capture_screenshot(void);
|
||||||
/**
|
/**
|
||||||
* Set the window title.
|
* Set the window title.
|
||||||
*/
|
*/
|
||||||
void rofi_view_set_window_title ( const char * title );
|
void rofi_view_set_window_title(const char *title);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set ellipsize mode to start.
|
* set ellipsize mode to start.
|
||||||
*/
|
*/
|
||||||
void rofi_view_ellipsize_start ( RofiViewState *state );
|
void rofi_view_ellipsize_start(RofiViewState *state);
|
||||||
/** @} */
|
/** @} */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,17 +28,17 @@
|
||||||
#ifndef ROFI_HBOX_H
|
#ifndef ROFI_HBOX_H
|
||||||
#define ROFI_HBOX_H
|
#define ROFI_HBOX_H
|
||||||
|
|
||||||
#include "widget.h"
|
|
||||||
#include "rofi-types.h"
|
#include "rofi-types.h"
|
||||||
|
#include "widget.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup box box
|
* @defgroup box box
|
||||||
* @ingroup widget
|
* @ingroup widget
|
||||||
*
|
*
|
||||||
* Widget used to pack multiple widgets either horizontally or vertically.
|
* Widget used to pack multiple widgets either horizontally or vertically.
|
||||||
* It supports packing widgets horizontally or vertically. Child widgets are always
|
* It supports packing widgets horizontally or vertically. Child widgets are
|
||||||
* expanded to the maximum size in the opposite direction of the packing direction.
|
* always expanded to the maximum size in the opposite direction of the packing
|
||||||
* e.g. vertically packed widgets use the full box width.
|
* direction. e.g. vertically packed widgets use the full box width.
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
@ -55,7 +55,7 @@ typedef struct _box box;
|
||||||
*
|
*
|
||||||
* @returns a newly created box, free with #widget_free
|
* @returns a newly created box, free with #widget_free
|
||||||
*/
|
*/
|
||||||
box * box_create ( widget *parent, const char *name, RofiOrientation type );
|
box *box_create(widget *parent, const char *name, RofiOrientation type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param box Handle to the box widget.
|
* @param box Handle to the box widget.
|
||||||
|
@ -64,6 +64,6 @@ box * box_create ( widget *parent, const char *name, RofiOrientation type );
|
||||||
*
|
*
|
||||||
* Add a widget to the box.
|
* Add a widget to the box.
|
||||||
*/
|
*/
|
||||||
void box_add ( box *box, widget *child, gboolean expand );
|
void box_add(box *box, widget *child, gboolean expand);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif // ROFI_HBOX_H
|
#endif // ROFI_HBOX_H
|
||||||
|
|
|
@ -49,7 +49,7 @@ typedef struct _container container;
|
||||||
*
|
*
|
||||||
* @returns a newly created container, free with #widget_free
|
* @returns a newly created container, free with #widget_free
|
||||||
*/
|
*/
|
||||||
container * container_create ( widget *parent, const char *name );
|
container *container_create(widget *parent, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param container Handle to the container widget.
|
* @param container Handle to the container widget.
|
||||||
|
@ -57,6 +57,6 @@ container * container_create ( widget *parent, const char *name );
|
||||||
*
|
*
|
||||||
* Add a widget to the container.
|
* Add a widget to the container.
|
||||||
*/
|
*/
|
||||||
void container_add ( container *container, widget *child );
|
void container_add(container *container, widget *child);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif // ROFI_CONTAINER_H
|
#endif // ROFI_CONTAINER_H
|
||||||
|
|
|
@ -49,19 +49,19 @@ typedef struct _icon icon;
|
||||||
*
|
*
|
||||||
* @returns a newly created icon, free with #widget_free
|
* @returns a newly created icon, free with #widget_free
|
||||||
*/
|
*/
|
||||||
icon * icon_create ( widget *parent, const char *name );
|
icon *icon_create(widget *parent, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param icon The icon widget handle.
|
* @param icon The icon widget handle.
|
||||||
* @param size The size of the icon.
|
* @param size The size of the icon.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void icon_set_size ( widget *icon, const int size );
|
void icon_set_size(widget *icon, const int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param icon The icon widget handle.
|
* @param icon The icon widget handle.
|
||||||
* @param surf The surface to display.
|
* @param surf The surface to display.
|
||||||
*/
|
*/
|
||||||
void icon_set_surface ( icon *icon, cairo_surface_t *surf );
|
void icon_set_surface(icon *icon, cairo_surface_t *surf);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif // ROFI_ICON_H
|
#endif // ROFI_ICON_H
|
||||||
|
|
|
@ -46,8 +46,7 @@ typedef struct _listview listview;
|
||||||
/**
|
/**
|
||||||
* The scrolling type used in the list view
|
* The scrolling type used in the list view
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Flip through the pages. */
|
/** Flip through the pages. */
|
||||||
LISTVIEW_SCROLL_PER_PAGE,
|
LISTVIEW_SCROLL_PER_PAGE,
|
||||||
/** keep selected item centered */
|
/** keep selected item centered */
|
||||||
|
@ -58,17 +57,20 @@ typedef enum
|
||||||
* @param tb The textbox to set
|
* @param tb The textbox to set
|
||||||
* @param entry The position of the textbox
|
* @param entry The position of the textbox
|
||||||
* @param udata User data
|
* @param udata User data
|
||||||
* @param type The textbox font style to apply to this entry (normal, selected, alternative row)
|
* @param type The textbox font style to apply to this entry (normal, selected,
|
||||||
|
* alternative row)
|
||||||
* @param full If true Set both text and style.
|
* @param full If true Set both text and style.
|
||||||
*
|
*
|
||||||
* Update callback, this is called to set the value of each (visible) element.
|
* Update callback, this is called to set the value of each (visible) element.
|
||||||
*/
|
*/
|
||||||
typedef void ( *listview_update_callback )( textbox *tb, icon *ico, unsigned int entry, void *udata, TextBoxFontType *type, gboolean full );
|
typedef void (*listview_update_callback)(textbox *tb, icon *ico,
|
||||||
|
unsigned int entry, void *udata,
|
||||||
|
TextBoxFontType *type, gboolean full);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback when a element is activated.
|
* Callback when a element is activated.
|
||||||
*/
|
*/
|
||||||
typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * );
|
typedef void (*listview_mouse_activated_cb)(listview *, gboolean, void *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parent The widget's parent.
|
* @param parent The widget's parent.
|
||||||
|
@ -80,7 +82,9 @@ typedef void ( *listview_mouse_activated_cb )( listview *, gboolean, void * );
|
||||||
*
|
*
|
||||||
* @returns a new listview
|
* @returns a new listview
|
||||||
*/
|
*/
|
||||||
listview *listview_create ( widget *parent, const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse );
|
listview *listview_create(widget *parent, const char *name,
|
||||||
|
listview_update_callback cb, void *udata,
|
||||||
|
unsigned int eh, gboolean reverse);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv The listview handle
|
* @param lv The listview handle
|
||||||
|
@ -88,7 +92,7 @@ listview *listview_create ( widget *parent, const char *name, listview_update_ca
|
||||||
*
|
*
|
||||||
* Set the maximum number of elements to display.
|
* Set the maximum number of elements to display.
|
||||||
*/
|
*/
|
||||||
void listview_set_num_elements ( listview *lv, unsigned int rows );
|
void listview_set_num_elements(listview *lv, unsigned int rows);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv The listview handle
|
* @param lv The listview handle
|
||||||
|
@ -96,7 +100,7 @@ void listview_set_num_elements ( listview *lv, unsigned int rows );
|
||||||
*
|
*
|
||||||
* Select the row, if selected > the number of rows, it selects the last one.
|
* Select the row, if selected > the number of rows, it selects the last one.
|
||||||
*/
|
*/
|
||||||
void listview_set_selected ( listview *lv, unsigned int selected );
|
void listview_set_selected(listview *lv, unsigned int selected);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv The listview handle
|
* @param lv The listview handle
|
||||||
|
@ -105,7 +109,7 @@ void listview_set_selected ( listview *lv, unsigned int selected );
|
||||||
*
|
*
|
||||||
* @returns the selected row.
|
* @returns the selected row.
|
||||||
*/
|
*/
|
||||||
unsigned int listview_get_selected ( listview *lv );
|
unsigned int listview_get_selected(listview *lv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv The listview handle
|
* @param lv The listview handle
|
||||||
|
@ -113,14 +117,14 @@ unsigned int listview_get_selected ( listview *lv );
|
||||||
* Move the selection one row up.
|
* Move the selection one row up.
|
||||||
* - Wrap around.
|
* - Wrap around.
|
||||||
*/
|
*/
|
||||||
void listview_nav_up ( listview *lv );
|
void listview_nav_up(listview *lv);
|
||||||
/**
|
/**
|
||||||
* @param lv listview handle.
|
* @param lv listview handle.
|
||||||
*
|
*
|
||||||
* Move the selection one row down.
|
* Move the selection one row down.
|
||||||
* - Wrap around.
|
* - Wrap around.
|
||||||
*/
|
*/
|
||||||
void listview_nav_down ( listview *lv );
|
void listview_nav_down(listview *lv);
|
||||||
/**
|
/**
|
||||||
* @param lv The listview handle
|
* @param lv The listview handle
|
||||||
*
|
*
|
||||||
|
@ -128,14 +132,14 @@ void listview_nav_down ( listview *lv );
|
||||||
* - No wrap around.
|
* - No wrap around.
|
||||||
* - Do not move to top row when at start.
|
* - Do not move to top row when at start.
|
||||||
*/
|
*/
|
||||||
void listview_nav_right ( listview *lv );
|
void listview_nav_right(listview *lv);
|
||||||
/**
|
/**
|
||||||
* @param lv The listview handle
|
* @param lv The listview handle
|
||||||
*
|
*
|
||||||
* Move the selection one column to the left.
|
* Move the selection one column to the left.
|
||||||
* - No wrap around.
|
* - No wrap around.
|
||||||
*/
|
*/
|
||||||
void listview_nav_left ( listview *lv );
|
void listview_nav_left(listview *lv);
|
||||||
/**
|
/**
|
||||||
* @param lv The listview handle
|
* @param lv The listview handle
|
||||||
*
|
*
|
||||||
|
@ -143,7 +147,7 @@ void listview_nav_left ( listview *lv );
|
||||||
* - No wrap around.
|
* - No wrap around.
|
||||||
* - Clip at top/bottom
|
* - Clip at top/bottom
|
||||||
*/
|
*/
|
||||||
void listview_nav_page_next ( listview *lv );
|
void listview_nav_page_next(listview *lv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv The listview handle
|
* @param lv The listview handle
|
||||||
|
@ -152,7 +156,7 @@ void listview_nav_page_next ( listview *lv );
|
||||||
* - No wrap around.
|
* - No wrap around.
|
||||||
* - Clip at top/bottom
|
* - Clip at top/bottom
|
||||||
*/
|
*/
|
||||||
void listview_nav_page_prev ( listview *lv );
|
void listview_nav_page_prev(listview *lv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object
|
* @param lv Handler to the listview object
|
||||||
|
@ -160,14 +164,14 @@ void listview_nav_page_prev ( listview *lv );
|
||||||
*
|
*
|
||||||
* Hide the scrollbar.
|
* Hide the scrollbar.
|
||||||
*/
|
*/
|
||||||
void listview_set_show_scrollbar ( listview *lv, gboolean enabled );
|
void listview_set_show_scrollbar(listview *lv, gboolean enabled);
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object
|
* @param lv Handler to the listview object
|
||||||
* @param width Width in pixels
|
* @param width Width in pixels
|
||||||
*
|
*
|
||||||
* Set the width of the scrollbar
|
* Set the width of the scrollbar
|
||||||
*/
|
*/
|
||||||
void listview_set_scrollbar_width ( listview *lv, unsigned int width );
|
void listview_set_scrollbar_width(listview *lv, unsigned int width);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object
|
* @param lv Handler to the listview object
|
||||||
|
@ -175,14 +179,15 @@ void listview_set_scrollbar_width ( listview *lv, unsigned int width );
|
||||||
*
|
*
|
||||||
* Set cycle mode. On last entry go to first.
|
* Set cycle mode. On last entry go to first.
|
||||||
*/
|
*/
|
||||||
void listview_set_cycle ( listview *lv, gboolean cycle );
|
void listview_set_cycle(listview *lv, gboolean cycle);
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object
|
* @param lv Handler to the listview object
|
||||||
* @param type ScrollType
|
* @param type ScrollType
|
||||||
*
|
*
|
||||||
* Set the scroll type ScrollType::LISTVIEW_SCROLL_CONTINIOUS or ScrollType::LISTVIEW_SCROLL_PER_PAGE
|
* Set the scroll type ScrollType::LISTVIEW_SCROLL_CONTINIOUS or
|
||||||
|
* ScrollType::LISTVIEW_SCROLL_PER_PAGE
|
||||||
*/
|
*/
|
||||||
void listview_set_scroll_type ( listview *lv, ScrollType type );
|
void listview_set_scroll_type(listview *lv, ScrollType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object
|
* @param lv Handler to the listview object
|
||||||
|
@ -191,21 +196,23 @@ void listview_set_scroll_type ( listview *lv, ScrollType type );
|
||||||
*
|
*
|
||||||
* Set the mouse activated callback.
|
* Set the mouse activated callback.
|
||||||
*/
|
*/
|
||||||
void listview_set_mouse_activated_cb ( listview *lv, listview_mouse_activated_cb cb, void *udata );
|
void listview_set_mouse_activated_cb(listview *lv,
|
||||||
|
listview_mouse_activated_cb cb,
|
||||||
|
void *udata);
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object
|
* @param lv Handler to the listview object
|
||||||
* @param enable boolean to enable/disable multi-select
|
* @param enable boolean to enable/disable multi-select
|
||||||
*
|
*
|
||||||
* Enable,disable multi-select.
|
* Enable,disable multi-select.
|
||||||
*/
|
*/
|
||||||
void listview_set_multi_select ( listview *lv, gboolean enable );
|
void listview_set_multi_select(listview *lv, gboolean enable);
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object.
|
* @param lv Handler to the listview object.
|
||||||
* @param num_lines the maximum number of lines to display.
|
* @param num_lines the maximum number of lines to display.
|
||||||
*
|
*
|
||||||
* Set the maximum number of lines to display.
|
* Set the maximum number of lines to display.
|
||||||
*/
|
*/
|
||||||
void listview_set_num_lines ( listview *lv, unsigned int num_lines );
|
void listview_set_num_lines(listview *lv, unsigned int num_lines);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object.
|
* @param lv Handler to the listview object.
|
||||||
|
@ -214,7 +221,7 @@ void listview_set_num_lines ( listview *lv, unsigned int num_lines );
|
||||||
*
|
*
|
||||||
* @returns get the number of lines to display.
|
* @returns get the number of lines to display.
|
||||||
*/
|
*/
|
||||||
unsigned int listview_get_num_lines ( listview *lv );
|
unsigned int listview_get_num_lines(listview *lv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object.
|
* @param lv Handler to the listview object.
|
||||||
|
@ -223,14 +230,14 @@ unsigned int listview_get_num_lines ( listview *lv );
|
||||||
*
|
*
|
||||||
* @returns get fixed-height.
|
* @returns get fixed-height.
|
||||||
*/
|
*/
|
||||||
gboolean listview_get_fixed_num_lines ( listview *lv );
|
gboolean listview_get_fixed_num_lines(listview *lv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object.
|
* @param lv Handler to the listview object.
|
||||||
*
|
*
|
||||||
* Set fixed num lines mode.
|
* Set fixed num lines mode.
|
||||||
*/
|
*/
|
||||||
void listview_set_fixed_num_lines ( listview *lv );
|
void listview_set_fixed_num_lines(listview *lv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object.
|
* @param lv Handler to the listview object.
|
||||||
|
@ -238,14 +245,14 @@ void listview_set_fixed_num_lines ( listview *lv );
|
||||||
*
|
*
|
||||||
* Set the maximum number of lines to display.
|
* Set the maximum number of lines to display.
|
||||||
*/
|
*/
|
||||||
void listview_set_max_lines ( listview *lv, unsigned int max_lines );
|
void listview_set_max_lines(listview *lv, unsigned int max_lines);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object.
|
* @param lv Handler to the listview object.
|
||||||
*
|
*
|
||||||
* Set ellipsize mode.
|
* Set ellipsize mode.
|
||||||
*/
|
*/
|
||||||
void listview_toggle_ellipsizing ( listview *lv );
|
void listview_toggle_ellipsizing(listview *lv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param lv Handler to the listview object.
|
* @param lv Handler to the listview object.
|
||||||
|
@ -253,7 +260,7 @@ void listview_toggle_ellipsizing ( listview *lv );
|
||||||
* Set ellipsize mode to start.
|
* Set ellipsize mode to start.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void listview_set_ellipsize_start ( listview *lv );
|
void listview_set_ellipsize_start(listview *lv);
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#endif // ROFI_LISTVIEW_H
|
#endif // ROFI_LISTVIEW_H
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
|
|
||||||
#ifndef ROFI_SCROLLBAR_H
|
#ifndef ROFI_SCROLLBAR_H
|
||||||
#define ROFI_SCROLLBAR_H
|
#define ROFI_SCROLLBAR_H
|
||||||
#include <cairo.h>
|
|
||||||
#include "widgets/widget.h"
|
|
||||||
#include "widgets/widget-internal.h"
|
#include "widgets/widget-internal.h"
|
||||||
|
#include "widgets/widget.h"
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Scrollbar Scrollbar
|
* @defgroup Scrollbar Scrollbar
|
||||||
|
@ -40,8 +40,7 @@
|
||||||
/**
|
/**
|
||||||
* Internal structure for the scrollbar.
|
* Internal structure for the scrollbar.
|
||||||
*/
|
*/
|
||||||
typedef struct _scrollbar
|
typedef struct _scrollbar {
|
||||||
{
|
|
||||||
widget widget;
|
widget widget;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
unsigned int pos;
|
unsigned int pos;
|
||||||
|
@ -57,7 +56,7 @@ typedef struct _scrollbar
|
||||||
*
|
*
|
||||||
* @returns the scrollbar object.
|
* @returns the scrollbar object.
|
||||||
*/
|
*/
|
||||||
scrollbar *scrollbar_create ( widget *parent, const char *name );
|
scrollbar *scrollbar_create(widget *parent, const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sb scrollbar object
|
* @param sb scrollbar object
|
||||||
|
@ -65,7 +64,7 @@ scrollbar *scrollbar_create ( widget *parent, const char *name );
|
||||||
*
|
*
|
||||||
* set the length of the handle relative to the max value of bar.
|
* set the length of the handle relative to the max value of bar.
|
||||||
*/
|
*/
|
||||||
void scrollbar_set_handle_length ( scrollbar *sb, unsigned int pos_length );
|
void scrollbar_set_handle_length(scrollbar *sb, unsigned int pos_length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sb scrollbar object
|
* @param sb scrollbar object
|
||||||
|
@ -73,7 +72,7 @@ void scrollbar_set_handle_length ( scrollbar *sb, unsigned int pos_length );
|
||||||
*
|
*
|
||||||
* set the position of the handle relative to the set max value of bar.
|
* set the position of the handle relative to the set max value of bar.
|
||||||
*/
|
*/
|
||||||
void scrollbar_set_handle ( scrollbar *sb, unsigned int pos );
|
void scrollbar_set_handle(scrollbar *sb, unsigned int pos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sb scrollbar object
|
* @param sb scrollbar object
|
||||||
|
@ -81,7 +80,7 @@ void scrollbar_set_handle ( scrollbar *sb, unsigned int pos );
|
||||||
*
|
*
|
||||||
* set the max value of the bar.
|
* set the max value of the bar.
|
||||||
*/
|
*/
|
||||||
void scrollbar_set_max_value ( scrollbar *sb, unsigned int max );
|
void scrollbar_set_max_value(scrollbar *sb, unsigned int max);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param sb scrollbar object
|
* @param sb scrollbar object
|
||||||
|
@ -89,7 +88,7 @@ void scrollbar_set_max_value ( scrollbar *sb, unsigned int max );
|
||||||
*
|
*
|
||||||
* Calculate the position of the click relative to the max value of bar
|
* Calculate the position of the click relative to the max value of bar
|
||||||
*/
|
*/
|
||||||
guint scrollbar_scroll_get_line ( const scrollbar *sb, int y );
|
guint scrollbar_scroll_get_line(const scrollbar *sb, int y);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif // ROFI_SCROLLBAR_H
|
#endif // ROFI_SCROLLBAR_H
|
||||||
|
|
|
@ -28,14 +28,14 @@
|
||||||
#ifndef ROFI_TEXTBOX_H
|
#ifndef ROFI_TEXTBOX_H
|
||||||
#define ROFI_TEXTBOX_H
|
#define ROFI_TEXTBOX_H
|
||||||
|
|
||||||
#include <xkbcommon/xkbcommon.h>
|
|
||||||
#include <pango/pango.h>
|
|
||||||
#include <pango/pango-fontmap.h>
|
|
||||||
#include <pango/pangocairo.h>
|
|
||||||
#include <cairo.h>
|
|
||||||
#include "widgets/widget.h"
|
|
||||||
#include "widgets/widget-internal.h"
|
|
||||||
#include "keyb.h"
|
#include "keyb.h"
|
||||||
|
#include "widgets/widget-internal.h"
|
||||||
|
#include "widgets/widget.h"
|
||||||
|
#include <cairo.h>
|
||||||
|
#include <pango/pango-fontmap.h>
|
||||||
|
#include <pango/pango.h>
|
||||||
|
#include <pango/pangocairo.h>
|
||||||
|
#include <xkbcommon/xkbcommon.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup Textbox Textbox
|
* @defgroup Textbox Textbox
|
||||||
|
@ -44,22 +44,21 @@
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Cache to hold font descriptions. This it to avoid having to lookup each time. */
|
/** Cache to hold font descriptions. This it to avoid having to lookup each
|
||||||
typedef struct TBFontConfig
|
* time. */
|
||||||
{
|
typedef struct TBFontConfig {
|
||||||
/** Font description */
|
/** Font description */
|
||||||
PangoFontDescription *pfd;
|
PangoFontDescription *pfd;
|
||||||
/** Font metrics */
|
/** Font metrics */
|
||||||
PangoFontMetrics *metrics;
|
PangoFontMetrics *metrics;
|
||||||
/** height */
|
/** height */
|
||||||
double height;
|
double height;
|
||||||
}TBFontConfig;
|
} TBFontConfig;
|
||||||
/**
|
/**
|
||||||
* Internal structure of a textbox widget.
|
* Internal structure of a textbox widget.
|
||||||
* TODO make this internal to textbox
|
* TODO make this internal to textbox
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
widget widget;
|
widget widget;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
short cursor;
|
short cursor;
|
||||||
|
@ -87,8 +86,7 @@ typedef struct
|
||||||
/**
|
/**
|
||||||
* Flags for configuring textbox behaviour and looks during creation.
|
* Flags for configuring textbox behaviour and looks during creation.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
TB_AUTOHEIGHT = 1 << 0,
|
TB_AUTOHEIGHT = 1 << 0,
|
||||||
TB_AUTOWIDTH = 1 << 1,
|
TB_AUTOWIDTH = 1 << 1,
|
||||||
TB_EDITABLE = 1 << 19,
|
TB_EDITABLE = 1 << 19,
|
||||||
|
@ -100,8 +98,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* Flags indicating current state of the textbox.
|
* Flags indicating current state of the textbox.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Normal */
|
/** Normal */
|
||||||
NORMAL = 0,
|
NORMAL = 0,
|
||||||
/** Text in box is urgent. */
|
/** Text in box is urgent. */
|
||||||
|
@ -118,9 +115,9 @@ typedef enum
|
||||||
/** Render font highlighted (inverted colors.) */
|
/** Render font highlighted (inverted colors.) */
|
||||||
HIGHLIGHT = 32,
|
HIGHLIGHT = 32,
|
||||||
/** Mask for alternate and highlighted */
|
/** Mask for alternate and highlighted */
|
||||||
FMOD_MASK = ( ALT | HIGHLIGHT ),
|
FMOD_MASK = (ALT | HIGHLIGHT),
|
||||||
/** Mask of bits indicating state */
|
/** Mask of bits indicating state */
|
||||||
STATE_MASK = ~( SELECTED | MARKUP | ALT | HIGHLIGHT )
|
STATE_MASK = ~(SELECTED | MARKUP | ALT | HIGHLIGHT)
|
||||||
} TextBoxFontType;
|
} TextBoxFontType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -138,15 +135,16 @@ typedef enum
|
||||||
* free with #widget_free
|
* free with #widget_free
|
||||||
* @returns a new #textbox
|
* @returns a new #textbox
|
||||||
*/
|
*/
|
||||||
textbox* textbox_create ( widget *parent, WidgetType type, const char *name, TextboxFlags flags,
|
textbox *textbox_create(widget *parent, WidgetType type, const char *name,
|
||||||
TextBoxFontType tbft, const char *text, double xalign, double yalign );
|
TextboxFlags flags, TextBoxFontType tbft,
|
||||||
|
const char *text, double xalign, double yalign);
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
* @param tbft The style of font to render.
|
* @param tbft The style of font to render.
|
||||||
*
|
*
|
||||||
* Set the font render style.
|
* Set the font render style.
|
||||||
*/
|
*/
|
||||||
void textbox_font ( textbox *tb, TextBoxFontType tbft );
|
void textbox_font(textbox *tb, TextBoxFontType tbft);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -154,7 +152,7 @@ void textbox_font ( textbox *tb, TextBoxFontType tbft );
|
||||||
*
|
*
|
||||||
* Set the text to show. Cursor is moved to end (if visible)
|
* Set the text to show. Cursor is moved to end (if visible)
|
||||||
*/
|
*/
|
||||||
void textbox_text ( textbox *tb, const char *text );
|
void textbox_text(textbox *tb, const char *text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -164,16 +162,16 @@ void textbox_text ( textbox *tb, const char *text );
|
||||||
*
|
*
|
||||||
* @return TRUE if action was taken.
|
* @return TRUE if action was taken.
|
||||||
*/
|
*/
|
||||||
int textbox_keybinding ( textbox *tb, KeyBindingAction action );
|
int textbox_keybinding(textbox *tb, KeyBindingAction action);
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
* @param pad The text to insert
|
* @param pad The text to insert
|
||||||
* @param pad_len the length of the text
|
* @param pad_len the length of the text
|
||||||
*
|
*
|
||||||
* The text should be one insert from a keypress.. the first gunichar is validated to be (or not) control
|
* The text should be one insert from a keypress.. the first gunichar is
|
||||||
* return TRUE if inserted
|
* validated to be (or not) control return TRUE if inserted
|
||||||
*/
|
*/
|
||||||
gboolean textbox_append_text ( textbox *tb, const char *pad, const int pad_len );
|
gboolean textbox_append_text(textbox *tb, const char *pad, const int pad_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -181,7 +179,7 @@ gboolean textbox_append_text ( textbox *tb, const char *pad, const int pad_len )
|
||||||
*
|
*
|
||||||
* Set the cursor position (string index)
|
* Set the cursor position (string index)
|
||||||
*/
|
*/
|
||||||
void textbox_cursor ( textbox *tb, int pos );
|
void textbox_cursor(textbox *tb, int pos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -191,19 +189,20 @@ void textbox_cursor ( textbox *tb, int pos );
|
||||||
*
|
*
|
||||||
* Insert the string str at position pos.
|
* Insert the string str at position pos.
|
||||||
*/
|
*/
|
||||||
void textbox_insert ( textbox *tb, const int char_pos, const char *str, const int slen );
|
void textbox_insert(textbox *tb, const int char_pos, const char *str,
|
||||||
|
const int slen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup the cached fonts. This is required to do
|
* Setup the cached fonts. This is required to do
|
||||||
* before any of the textbox_ functions is called.
|
* before any of the textbox_ functions is called.
|
||||||
* Clean with textbox_cleanup()
|
* Clean with textbox_cleanup()
|
||||||
*/
|
*/
|
||||||
void textbox_setup ( void );
|
void textbox_setup(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleanup the allocated colors and fonts by textbox_setup().
|
* Cleanup the allocated colors and fonts by textbox_setup().
|
||||||
*/
|
*/
|
||||||
void textbox_cleanup ( void );
|
void textbox_cleanup(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -212,7 +211,7 @@ void textbox_cleanup ( void );
|
||||||
*
|
*
|
||||||
* @returns the height of the textbox in pixels.
|
* @returns the height of the textbox in pixels.
|
||||||
*/
|
*/
|
||||||
int textbox_get_height ( const textbox *tb );
|
int textbox_get_height(const textbox *tb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -221,7 +220,7 @@ int textbox_get_height ( const textbox *tb );
|
||||||
*
|
*
|
||||||
* @returns the height of the string in pixels.
|
* @returns the height of the string in pixels.
|
||||||
*/
|
*/
|
||||||
int textbox_get_font_height ( const textbox *tb );
|
int textbox_get_font_height(const textbox *tb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -230,27 +229,27 @@ int textbox_get_font_height ( const textbox *tb );
|
||||||
*
|
*
|
||||||
* @returns the width of the string in pixels.
|
* @returns the width of the string in pixels.
|
||||||
*/
|
*/
|
||||||
int textbox_get_font_width ( const textbox *tb );
|
int textbox_get_font_width(const textbox *tb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Estimate the width of a character.
|
* Estimate the width of a character.
|
||||||
*
|
*
|
||||||
* @returns the width of a character in pixels.
|
* @returns the width of a character in pixels.
|
||||||
*/
|
*/
|
||||||
double textbox_get_estimated_char_width ( void );
|
double textbox_get_estimated_char_width(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Estimate the width of a 0.
|
* Estimate the width of a 0.
|
||||||
*
|
*
|
||||||
* @returns the width of a 0 in pixels.
|
* @returns the width of a 0 in pixels.
|
||||||
*/
|
*/
|
||||||
double textbox_get_estimated_ch ( void );
|
double textbox_get_estimated_ch(void);
|
||||||
/**
|
/**
|
||||||
* Estimate the height of a character.
|
* Estimate the height of a character.
|
||||||
*
|
*
|
||||||
* @returns the height of a character in pixels.
|
* @returns the height of a character in pixels.
|
||||||
*/
|
*/
|
||||||
double textbox_get_estimated_char_height ( void );
|
double textbox_get_estimated_char_height(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -259,7 +258,7 @@ double textbox_get_estimated_char_height ( void );
|
||||||
*
|
*
|
||||||
* Remove dlen bytes from position pos.
|
* Remove dlen bytes from position pos.
|
||||||
*/
|
*/
|
||||||
void textbox_delete ( textbox *tb, int pos, int dlen );
|
void textbox_delete(textbox *tb, int pos, int dlen);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -271,32 +270,32 @@ void textbox_delete ( textbox *tb, int pos, int dlen );
|
||||||
* Move and resize the textbox.
|
* Move and resize the textbox.
|
||||||
* TODO remove for #widget_resize and #widget_move
|
* TODO remove for #widget_resize and #widget_move
|
||||||
*/
|
*/
|
||||||
void textbox_moveresize ( textbox *tb, int x, int y, int w, int h );
|
void textbox_moveresize(textbox *tb, int x, int y, int w, int h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
* @param eh The number of rows to display
|
* @param eh The number of rows to display
|
||||||
*
|
*
|
||||||
* Get the (estimated) with of a character, can be used to calculate window width.
|
* Get the (estimated) with of a character, can be used to calculate window
|
||||||
* This includes padding.
|
* width. This includes padding.
|
||||||
*
|
*
|
||||||
* @returns the estimated width of a character.
|
* @returns the estimated width of a character.
|
||||||
*/
|
*/
|
||||||
int textbox_get_estimated_height ( const textbox *tb, int eh );
|
int textbox_get_estimated_height(const textbox *tb, int eh);
|
||||||
/**
|
/**
|
||||||
* @param font The name of the font used.
|
* @param font The name of the font used.
|
||||||
* @param p The new default PangoContext
|
* @param p The new default PangoContext
|
||||||
*
|
*
|
||||||
* Set the default pango context (with font description) for all textboxes.
|
* Set the default pango context (with font description) for all textboxes.
|
||||||
*/
|
*/
|
||||||
void textbox_set_pango_context ( const char *font, PangoContext *p );
|
void textbox_set_pango_context(const char *font, PangoContext *p);
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
* @param list New pango attributes
|
* @param list New pango attributes
|
||||||
*
|
*
|
||||||
* Sets list as active pango attributes.
|
* Sets list as active pango attributes.
|
||||||
*/
|
*/
|
||||||
void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list );
|
void textbox_set_pango_attributes(textbox *tb, PangoAttrList *list);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -305,14 +304,14 @@ void textbox_set_pango_attributes ( textbox *tb, PangoAttrList *list );
|
||||||
*
|
*
|
||||||
* @returns the pango attributes
|
* @returns the pango attributes
|
||||||
*/
|
*/
|
||||||
PangoAttrList *textbox_get_pango_attributes ( textbox *tb );
|
PangoAttrList *textbox_get_pango_attributes(textbox *tb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
*
|
*
|
||||||
* @returns the visible text.
|
* @returns the visible text.
|
||||||
*/
|
*/
|
||||||
const char *textbox_get_visible_text ( const textbox *tb );
|
const char *textbox_get_visible_text(const textbox *tb);
|
||||||
/**
|
/**
|
||||||
* @param wid The handle to the textbox.
|
* @param wid The handle to the textbox.
|
||||||
*
|
*
|
||||||
|
@ -320,14 +319,14 @@ const char *textbox_get_visible_text ( const textbox *tb );
|
||||||
*
|
*
|
||||||
* @returns the desired width of the textbox.
|
* @returns the desired width of the textbox.
|
||||||
*/
|
*/
|
||||||
int textbox_get_desired_width ( widget *wid );
|
int textbox_get_desired_width(widget *wid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
*
|
*
|
||||||
* Move the cursor to the end of the string.
|
* Move the cursor to the end of the string.
|
||||||
*/
|
*/
|
||||||
void textbox_cursor_end ( textbox *tb );
|
void textbox_cursor_end(textbox *tb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tb Handle to the textbox
|
* @param tb Handle to the textbox
|
||||||
|
@ -335,6 +334,6 @@ void textbox_cursor_end ( textbox *tb );
|
||||||
*
|
*
|
||||||
* Set the ellipsizing mode used on the string.
|
* Set the ellipsizing mode used on the string.
|
||||||
*/
|
*/
|
||||||
void textbox_set_ellipsize ( textbox *tb, PangoEllipsizeMode mode );
|
void textbox_set_ellipsize(textbox *tb, PangoEllipsizeMode mode);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif //ROFI_TEXTBOX_H
|
#endif // ROFI_TEXTBOX_H
|
||||||
|
|
|
@ -32,8 +32,7 @@
|
||||||
/**
|
/**
|
||||||
* Data structure holding the internal state of the Widget
|
* Data structure holding the internal state of the Widget
|
||||||
*/
|
*/
|
||||||
struct _widget
|
struct _widget {
|
||||||
{
|
|
||||||
/** The type of the widget */
|
/** The type of the widget */
|
||||||
WidgetType type;
|
WidgetType type;
|
||||||
/** X position relative to parent */
|
/** X position relative to parent */
|
||||||
|
@ -68,23 +67,23 @@ struct _widget
|
||||||
/** Internal */
|
/** Internal */
|
||||||
gboolean need_redraw;
|
gboolean need_redraw;
|
||||||
/** get width of widget implementation function */
|
/** get width of widget implementation function */
|
||||||
int ( *get_width )( struct _widget * );
|
int (*get_width)(struct _widget *);
|
||||||
/** get height of widget implementation function */
|
/** get height of widget implementation function */
|
||||||
int ( *get_height )( struct _widget * );
|
int (*get_height)(struct _widget *);
|
||||||
/** draw widget implementation function */
|
/** draw widget implementation function */
|
||||||
void ( *draw )( struct _widget *widget, cairo_t *draw );
|
void (*draw)(struct _widget *widget, cairo_t *draw);
|
||||||
/** resize widget implementation function */
|
/** resize widget implementation function */
|
||||||
void ( *resize )( struct _widget *, short, short );
|
void (*resize)(struct _widget *, short, short);
|
||||||
/** update widget implementation function */
|
/** update widget implementation function */
|
||||||
void ( *update )( struct _widget * );
|
void (*update)(struct _widget *);
|
||||||
|
|
||||||
/** Handle mouse motion, used for dragging */
|
/** Handle mouse motion, used for dragging */
|
||||||
gboolean ( *motion_notify )( struct _widget *, gint x, gint y );
|
gboolean (*motion_notify)(struct _widget *, gint x, gint y);
|
||||||
|
|
||||||
int ( *get_desired_height )( struct _widget * );
|
int (*get_desired_height)(struct _widget *);
|
||||||
int ( *get_desired_width )( struct _widget * );
|
int (*get_desired_width)(struct _widget *);
|
||||||
|
|
||||||
void ( *set_state ) ( struct _widget *, const char * );
|
void (*set_state)(struct _widget *, const char *);
|
||||||
|
|
||||||
/** widget find_mouse_target callback */
|
/** widget find_mouse_target callback */
|
||||||
widget_find_mouse_target_cb find_mouse_target;
|
widget_find_mouse_target_cb find_mouse_target;
|
||||||
|
@ -94,7 +93,7 @@ struct _widget
|
||||||
void *trigger_action_cb_data;
|
void *trigger_action_cb_data;
|
||||||
|
|
||||||
/** Free widget callback */
|
/** Free widget callback */
|
||||||
void ( *free )( struct _widget *widget );
|
void (*free)(struct _widget *widget);
|
||||||
|
|
||||||
/** Name of widget (used for theming) */
|
/** Name of widget (used for theming) */
|
||||||
char *name;
|
char *name;
|
||||||
|
@ -110,7 +109,8 @@ struct _widget
|
||||||
* Initializes the widget structure.
|
* Initializes the widget structure.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void widget_init ( widget *wid, widget *parent, WidgetType type, const char *name );
|
void widget_init(widget *wid, widget *parent, WidgetType type,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle.
|
* @param widget The widget handle.
|
||||||
|
@ -118,7 +118,7 @@ void widget_init ( widget *wid, widget *parent, WidgetType type, const char *nam
|
||||||
*
|
*
|
||||||
* Set the state of the widget.
|
* Set the state of the widget.
|
||||||
*/
|
*/
|
||||||
void widget_set_state ( widget *widget, const char *state );
|
void widget_set_state(widget *widget, const char *state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle.
|
* @param wid The widget handle.
|
||||||
|
@ -127,7 +127,7 @@ void widget_set_state ( widget *widget, const char *state );
|
||||||
*
|
*
|
||||||
* @returns the left padding in pixels.
|
* @returns the left padding in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_padding_get_left ( const widget *wid );
|
int widget_padding_get_left(const widget *wid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle.
|
* @param wid The widget handle.
|
||||||
|
@ -136,7 +136,7 @@ int widget_padding_get_left ( const widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the right padding in pixels.
|
* @returns the right padding in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_padding_get_right ( const widget *wid );
|
int widget_padding_get_right(const widget *wid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle.
|
* @param wid The widget handle.
|
||||||
|
@ -145,7 +145,7 @@ int widget_padding_get_right ( const widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the top padding in pixels.
|
* @returns the top padding in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_padding_get_top ( const widget *wid );
|
int widget_padding_get_top(const widget *wid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle.
|
* @param wid The widget handle.
|
||||||
|
@ -154,7 +154,7 @@ int widget_padding_get_top ( const widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the bottom padding in pixels.
|
* @returns the bottom padding in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_padding_get_bottom ( const widget *wid );
|
int widget_padding_get_bottom(const widget *wid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle.
|
* @param wid The widget handle.
|
||||||
|
@ -163,7 +163,7 @@ int widget_padding_get_bottom ( const widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the widget width, excluding padding.
|
* @returns the widget width, excluding padding.
|
||||||
*/
|
*/
|
||||||
int widget_padding_get_remaining_width ( const widget *wid );
|
int widget_padding_get_remaining_width(const widget *wid);
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle.
|
* @param wid The widget handle.
|
||||||
*
|
*
|
||||||
|
@ -171,7 +171,7 @@ int widget_padding_get_remaining_width ( const widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the widget height, excluding padding.
|
* @returns the widget height, excluding padding.
|
||||||
*/
|
*/
|
||||||
int widget_padding_get_remaining_height ( const widget *wid );
|
int widget_padding_get_remaining_height(const widget *wid);
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle.
|
* @param wid The widget handle.
|
||||||
*
|
*
|
||||||
|
@ -179,7 +179,7 @@ int widget_padding_get_remaining_height ( const widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the top and bottom padding of the widget in pixels.
|
* @returns the top and bottom padding of the widget in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_padding_get_padding_height ( const widget *wid );
|
int widget_padding_get_padding_height(const widget *wid);
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle.
|
* @param wid The widget handle.
|
||||||
*
|
*
|
||||||
|
@ -187,5 +187,5 @@ int widget_padding_get_padding_height ( const widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the left and right padding of the widget in pixels.
|
* @returns the left and right padding of the widget in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_padding_get_padding_width ( const widget *wid );
|
int widget_padding_get_padding_width(const widget *wid);
|
||||||
#endif // WIDGET_INTERNAL_H
|
#endif // WIDGET_INTERNAL_H
|
||||||
|
|
|
@ -27,19 +27,19 @@
|
||||||
|
|
||||||
#ifndef ROFI_WIDGET_H
|
#ifndef ROFI_WIDGET_H
|
||||||
#define ROFI_WIDGET_H
|
#define ROFI_WIDGET_H
|
||||||
#include <glib.h>
|
#include "keyb.h"
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
#include <glib.h>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xproto.h>
|
#include <xcb/xproto.h>
|
||||||
#include "keyb.h"
|
|
||||||
/**
|
/**
|
||||||
* @defgroup widget widget
|
* @defgroup widget widget
|
||||||
*
|
*
|
||||||
* Generic abstract widget class. Widgets should 'inherit' from this class (first structure in there structure should be
|
* Generic abstract widget class. Widgets should 'inherit' from this class
|
||||||
* widget).
|
* (first structure in there structure should be widget). The generic widget
|
||||||
* The generic widget implements generic functions like get_width, get_height, draw, resize, update, free and
|
* implements generic functions like get_width, get_height, draw, resize,
|
||||||
* clicked.
|
* update, free and clicked. It also holds information about how the widget
|
||||||
* It also holds information about how the widget should be packed.
|
* should be packed.
|
||||||
*
|
*
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
@ -53,8 +53,7 @@ typedef struct _widget widget;
|
||||||
/**
|
/**
|
||||||
* Type of the widget. It is used to bubble events to the relevant widget.
|
* Type of the widget. It is used to bubble events to the relevant widget.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Default type */
|
/** Default type */
|
||||||
WIDGET_TYPE_UNKNOWN,
|
WIDGET_TYPE_UNKNOWN,
|
||||||
/** The listview widget */
|
/** The listview widget */
|
||||||
|
@ -74,8 +73,7 @@ typedef enum
|
||||||
/**
|
/**
|
||||||
* Whether and how the action was handled
|
* Whether and how the action was handled
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** The action was ignore and should bubble */
|
/** The action was ignore and should bubble */
|
||||||
WIDGET_TRIGGER_ACTION_RESULT_IGNORED,
|
WIDGET_TRIGGER_ACTION_RESULT_IGNORED,
|
||||||
/** The action was handled directly */
|
/** The action was handled directly */
|
||||||
|
@ -92,11 +90,13 @@ typedef enum
|
||||||
* @param x The X coordination of the mouse event relative to @param widget
|
* @param x The X coordination of the mouse event relative to @param widget
|
||||||
* @param y The Y coordination of the mouse event relative to @param widget
|
* @param y The Y coordination of the mouse event relative to @param widget
|
||||||
*
|
*
|
||||||
* This callback must only iterate over the children of a Widget, and return NULL if none of them is relevant.
|
* This callback must only iterate over the children of a Widget, and return
|
||||||
|
* NULL if none of them is relevant.
|
||||||
*
|
*
|
||||||
* @returns A child widget if found, NULL otherwise
|
* @returns A child widget if found, NULL otherwise
|
||||||
*/
|
*/
|
||||||
typedef widget * ( *widget_find_mouse_target_cb )( widget *widget, WidgetType type, gint x, gint y );
|
typedef widget *(*widget_find_mouse_target_cb)(widget *widget, WidgetType type,
|
||||||
|
gint x, gint y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The target widget
|
* @param widget The target widget
|
||||||
|
@ -105,14 +105,18 @@ typedef widget * ( *widget_find_mouse_target_cb )( widget *widget, WidgetType ty
|
||||||
* @param y The Y coordination of the mouse event relative to @param widget
|
* @param y The Y coordination of the mouse event relative to @param widget
|
||||||
* @param user_data The data passed to widget_set_trigger_action_handler()
|
* @param user_data The data passed to widget_set_trigger_action_handler()
|
||||||
*
|
*
|
||||||
* This callback should handle the action if relevant, and returns whether it did or not.
|
* This callback should handle the action if relevant, and returns whether it
|
||||||
|
* did or not.
|
||||||
*
|
*
|
||||||
* @returns Whether the action was handled or not, see enum values for details
|
* @returns Whether the action was handled or not, see enum values for details
|
||||||
*/
|
*/
|
||||||
typedef WidgetTriggerActionResult ( *widget_trigger_action_cb )( widget *widget, guint action, gint x, gint y, void *user_data );
|
typedef WidgetTriggerActionResult (*widget_trigger_action_cb)(widget *widget,
|
||||||
|
guint action,
|
||||||
|
gint x, gint y,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
/** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
|
/** Macro to get widget from an implementation (e.g. textbox/scrollbar) */
|
||||||
#define WIDGET( a ) ( (widget *) ( a ) )
|
#define WIDGET(a) ((widget *)(a))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to check
|
* @param widget The widget to check
|
||||||
|
@ -123,7 +127,7 @@ typedef WidgetTriggerActionResult ( *widget_trigger_action_cb )( widget *widget,
|
||||||
*
|
*
|
||||||
* @return TRUE if x,y falls within the widget
|
* @return TRUE if x,y falls within the widget
|
||||||
*/
|
*/
|
||||||
int widget_intersect ( const widget *widget, int x, int y );
|
int widget_intersect(const widget *widget, int x, int y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget to move
|
* @param widget The widget to move
|
||||||
|
@ -132,7 +136,7 @@ int widget_intersect ( const widget *widget, int x, int y );
|
||||||
*
|
*
|
||||||
* Moves the widget.
|
* Moves the widget.
|
||||||
*/
|
*/
|
||||||
void widget_move ( widget *widget, short x, short y );
|
void widget_move(widget *widget, short x, short y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget Handle to widget
|
* @param widget Handle to widget
|
||||||
|
@ -140,7 +144,7 @@ void widget_move ( widget *widget, short x, short y );
|
||||||
* Get the type of the widget.
|
* Get the type of the widget.
|
||||||
* @returns The type of the widget.
|
* @returns The type of the widget.
|
||||||
*/
|
*/
|
||||||
WidgetType widget_type ( widget *widget );
|
WidgetType widget_type(widget *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget Handle to widget
|
* @param widget Handle to widget
|
||||||
|
@ -148,7 +152,7 @@ WidgetType widget_type ( widget *widget );
|
||||||
*
|
*
|
||||||
* Set the widget type.
|
* Set the widget type.
|
||||||
*/
|
*/
|
||||||
void widget_set_type ( widget *widget, WidgetType type );
|
void widget_set_type(widget *widget, WidgetType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget Handle to widget
|
* @param widget Handle to widget
|
||||||
|
@ -156,7 +160,7 @@ void widget_set_type ( widget *widget, WidgetType type );
|
||||||
* Check if widget is enabled.
|
* Check if widget is enabled.
|
||||||
* @returns TRUE when widget is enabled.
|
* @returns TRUE when widget is enabled.
|
||||||
*/
|
*/
|
||||||
gboolean widget_enabled ( widget *widget );
|
gboolean widget_enabled(widget *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget Handle to widget
|
* @param widget Handle to widget
|
||||||
|
@ -164,27 +168,23 @@ gboolean widget_enabled ( widget *widget );
|
||||||
*
|
*
|
||||||
* Disable the widget.
|
* Disable the widget.
|
||||||
*/
|
*/
|
||||||
void widget_set_enabled ( widget *widget, gboolean enabled );
|
void widget_set_enabled(widget *widget, gboolean enabled);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget Handle to widget
|
* @param widget Handle to widget
|
||||||
*
|
*
|
||||||
* Disable the widget.
|
* Disable the widget.
|
||||||
*/
|
*/
|
||||||
static inline
|
static inline void widget_disable(widget *widget) {
|
||||||
void widget_disable ( widget *widget )
|
widget_set_enabled(widget, FALSE);
|
||||||
{
|
|
||||||
widget_set_enabled ( widget, FALSE );
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param widget Handle to widget
|
* @param widget Handle to widget
|
||||||
*
|
*
|
||||||
* Enable the widget.
|
* Enable the widget.
|
||||||
*/
|
*/
|
||||||
static inline
|
static inline void widget_enable(widget *widget) {
|
||||||
void widget_enable ( widget *widget )
|
widget_set_enabled(widget, TRUE);
|
||||||
{
|
|
||||||
widget_set_enabled ( widget, TRUE );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -193,14 +193,14 @@ void widget_enable ( widget *widget )
|
||||||
*
|
*
|
||||||
* Render the textbox.
|
* Render the textbox.
|
||||||
*/
|
*/
|
||||||
void widget_draw ( widget *widget, cairo_t *d );
|
void widget_draw(widget *widget, cairo_t *d);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid Handle to the widget
|
* @param wid Handle to the widget
|
||||||
*
|
*
|
||||||
* Free the widget and all allocated memory.
|
* Free the widget and all allocated memory.
|
||||||
*/
|
*/
|
||||||
void widget_free ( widget *wid );
|
void widget_free(widget *wid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget toresize
|
* @param widget The widget toresize
|
||||||
|
@ -209,35 +209,35 @@ void widget_free ( widget *wid );
|
||||||
*
|
*
|
||||||
* Resizes the widget.
|
* Resizes the widget.
|
||||||
*/
|
*/
|
||||||
void widget_resize ( widget *widget, short w, short h );
|
void widget_resize(widget *widget, short w, short h);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle
|
* @param widget The widget handle
|
||||||
*
|
*
|
||||||
* @returns the height of the widget.
|
* @returns the height of the widget.
|
||||||
*/
|
*/
|
||||||
int widget_get_height ( widget *widget );
|
int widget_get_height(widget *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle
|
* @param widget The widget handle
|
||||||
*
|
*
|
||||||
* @returns the width of the widget.
|
* @returns the width of the widget.
|
||||||
*/
|
*/
|
||||||
int widget_get_width ( widget *widget );
|
int widget_get_width(widget *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle
|
* @param widget The widget handle
|
||||||
*
|
*
|
||||||
* @returns the y position of the widget relative to its parent.
|
* @returns the y position of the widget relative to its parent.
|
||||||
*/
|
*/
|
||||||
int widget_get_y_pos ( widget *widget );
|
int widget_get_y_pos(widget *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle
|
* @param widget The widget handle
|
||||||
*
|
*
|
||||||
* @returns the x position of the widget relative to its parent.
|
* @returns the x position of the widget relative to its parent.
|
||||||
*/
|
*/
|
||||||
int widget_get_x_pos ( widget *widget );
|
int widget_get_x_pos(widget *widget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle
|
* @param widget The widget handle
|
||||||
|
@ -246,7 +246,7 @@ int widget_get_x_pos ( widget *widget );
|
||||||
*
|
*
|
||||||
* Will modify param x and param y to make them relative to param widget .
|
* Will modify param x and param y to make them relative to param widget .
|
||||||
*/
|
*/
|
||||||
void widget_xy_to_relative ( widget *widget, gint *x, gint *y );
|
void widget_xy_to_relative(widget *widget, gint *x, gint *y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param widget The widget handle
|
* @param widget The widget handle
|
||||||
|
@ -254,20 +254,20 @@ void widget_xy_to_relative ( widget *widget, gint *x, gint *y );
|
||||||
* Update the widget, and its parent recursively.
|
* Update the widget, and its parent recursively.
|
||||||
* This should be called when size of widget changes.
|
* This should be called when size of widget changes.
|
||||||
*/
|
*/
|
||||||
void widget_update ( widget *widget );
|
void widget_update(widget *widget);
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
*
|
*
|
||||||
* Indicate that the widget needs to be redrawn.
|
* Indicate that the widget needs to be redrawn.
|
||||||
* This is done by setting the redraw flag on the toplevel widget.
|
* This is done by setting the redraw flag on the toplevel widget.
|
||||||
*/
|
*/
|
||||||
void widget_queue_redraw ( widget *wid );
|
void widget_queue_redraw(widget *wid);
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
*
|
*
|
||||||
* Check the flag indicating the widget needs to be redrawn.
|
* Check the flag indicating the widget needs to be redrawn.
|
||||||
*/
|
*/
|
||||||
gboolean widget_need_redraw ( widget *wid );
|
gboolean widget_need_redraw(widget *wid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
|
@ -279,7 +279,7 @@ gboolean widget_need_redraw ( widget *wid );
|
||||||
*
|
*
|
||||||
* @returns returns the widget that should handle the mouse event.
|
* @returns returns the widget that should handle the mouse event.
|
||||||
*/
|
*/
|
||||||
widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint x, gint y );
|
widget *widget_find_mouse_target(widget *wid, WidgetType type, gint x, gint y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
|
@ -292,7 +292,8 @@ widget *widget_find_mouse_target ( widget *wid, WidgetType type, gint x, gint y
|
||||||
*
|
*
|
||||||
* @returns Whether the action was handled or not
|
* @returns Whether the action was handled or not
|
||||||
*/
|
*/
|
||||||
WidgetTriggerActionResult widget_trigger_action ( widget *wid, guint action, gint x, gint y );
|
WidgetTriggerActionResult widget_trigger_action(widget *wid, guint action,
|
||||||
|
gint x, gint y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
|
@ -301,7 +302,8 @@ WidgetTriggerActionResult widget_trigger_action ( widget *wid, guint action, gin
|
||||||
*
|
*
|
||||||
* Override the widget trigger action handler on widget.
|
* Override the widget trigger action handler on widget.
|
||||||
*/
|
*/
|
||||||
void widget_set_trigger_action_handler ( widget *wid, widget_trigger_action_cb cb, void *cb_data );
|
void widget_set_trigger_action_handler(widget *wid, widget_trigger_action_cb cb,
|
||||||
|
void *cb_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
|
@ -312,7 +314,7 @@ void widget_set_trigger_action_handler ( widget *wid, widget_trigger_action_cb c
|
||||||
*
|
*
|
||||||
* @returns TRUE when handled.
|
* @returns TRUE when handled.
|
||||||
*/
|
*/
|
||||||
gboolean widget_motion_notify ( widget *wid, gint x, gint y );
|
gboolean widget_motion_notify(widget *wid, gint x, gint y);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
|
@ -321,7 +323,7 @@ gboolean widget_motion_notify ( widget *wid, gint x, gint y );
|
||||||
*
|
*
|
||||||
* @returns the desired height of the widget in pixels.
|
* @returns the desired height of the widget in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_get_desired_height ( widget *wid );
|
int widget_get_desired_height(widget *wid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
|
@ -330,7 +332,7 @@ int widget_get_desired_height ( widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the desired width of the widget in pixels.
|
* @returns the desired width of the widget in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_get_desired_width ( widget *wid );
|
int widget_get_desired_width(widget *wid);
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
*
|
*
|
||||||
|
@ -338,7 +340,7 @@ int widget_get_desired_width ( widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the absolute x-position of widget of the widget in pixels.
|
* @returns the absolute x-position of widget of the widget in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_get_absolute_xpos ( widget *wid );
|
int widget_get_absolute_xpos(widget *wid);
|
||||||
/**
|
/**
|
||||||
* @param wid The widget handle
|
* @param wid The widget handle
|
||||||
*
|
*
|
||||||
|
@ -346,6 +348,6 @@ int widget_get_absolute_xpos ( widget *wid );
|
||||||
*
|
*
|
||||||
* @returns the absolute y-position of widget of the widget in pixels.
|
* @returns the absolute y-position of widget of the widget in pixels.
|
||||||
*/
|
*/
|
||||||
int widget_get_absolute_ypos ( widget *wid );
|
int widget_get_absolute_ypos(widget *wid);
|
||||||
/**@}*/
|
/**@}*/
|
||||||
#endif // ROFI_WIDGET_H
|
#endif // ROFI_WIDGET_H
|
||||||
|
|
|
@ -29,19 +29,19 @@
|
||||||
#define ROFI_XCB_INTERNAL_H
|
#define ROFI_XCB_INTERNAL_H
|
||||||
/** Indication we accept that startup notification api is not yet frozen */
|
/** Indication we accept that startup notification api is not yet frozen */
|
||||||
#define SN_API_NOT_YET_FROZEN
|
#define SN_API_NOT_YET_FROZEN
|
||||||
|
#include <glib.h>
|
||||||
#include <libsn/sn.h>
|
#include <libsn/sn.h>
|
||||||
|
|
||||||
|
#include <libgwater-xcb.h>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_ewmh.h>
|
#include <xcb/xcb_ewmh.h>
|
||||||
#include "libgwater-xcb.h"
|
|
||||||
|
|
||||||
#include "nkutils-bindings.h"
|
#include <nkutils-bindings.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Structure to keep xcb stuff around.
|
* Structure to keep xcb stuff around.
|
||||||
*/
|
*/
|
||||||
struct _xcb_stuff
|
struct _xcb_stuff {
|
||||||
{
|
|
||||||
GMainLoop *main_loop;
|
GMainLoop *main_loop;
|
||||||
GWaterXcbSource *source;
|
GWaterXcbSource *source;
|
||||||
xcb_connection_t *connection;
|
xcb_connection_t *connection;
|
||||||
|
@ -51,8 +51,7 @@ struct _xcb_stuff
|
||||||
SnDisplay *sndisplay;
|
SnDisplay *sndisplay;
|
||||||
SnLauncheeContext *sncontext;
|
SnLauncheeContext *sncontext;
|
||||||
struct _workarea *monitors;
|
struct _workarea *monitors;
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
/** Flag indicating first event */
|
/** Flag indicating first event */
|
||||||
uint8_t first_event;
|
uint8_t first_event;
|
||||||
/** Keyboard device id */
|
/** Keyboard device id */
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
#ifndef ROFI_XCB_H
|
#ifndef ROFI_XCB_H
|
||||||
#define ROFI_XCB_H
|
#define ROFI_XCB_H
|
||||||
|
|
||||||
#include <xcb/xcb.h>
|
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
#include <xcb/xcb.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xcb data structure type declaration.
|
* xcb data structure type declaration.
|
||||||
|
@ -46,7 +46,7 @@ extern xcb_stuff *xcb;
|
||||||
*
|
*
|
||||||
* @returns the root window.
|
* @returns the root window.
|
||||||
*/
|
*/
|
||||||
xcb_window_t xcb_stuff_get_root_window ( void );
|
xcb_window_t xcb_stuff_get_root_window(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param w The xcb_window_t to read property from.
|
* @param w The xcb_window_t to read property from.
|
||||||
|
@ -57,7 +57,7 @@ xcb_window_t xcb_stuff_get_root_window ( void );
|
||||||
*
|
*
|
||||||
* @returns a newly allocated string with the result or NULL
|
* @returns a newly allocated string with the result or NULL
|
||||||
*/
|
*/
|
||||||
char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom );
|
char *window_get_text_prop(xcb_window_t w, xcb_atom_t atom);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param w The xcb_window_t to set property on
|
* @param w The xcb_window_t to set property on
|
||||||
|
@ -67,28 +67,22 @@ char* window_get_text_prop ( xcb_window_t w, xcb_atom_t atom );
|
||||||
*
|
*
|
||||||
* Set property on window.
|
* Set property on window.
|
||||||
*/
|
*/
|
||||||
void window_set_atom_prop ( xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms, int count );
|
void window_set_atom_prop(xcb_window_t w, xcb_atom_t prop, xcb_atom_t *atoms,
|
||||||
|
int count);
|
||||||
|
|
||||||
/** For getting the atoms in an enum */
|
/** For getting the atoms in an enum */
|
||||||
#define ATOM_ENUM( x ) x
|
#define ATOM_ENUM(x) x
|
||||||
/** Get the atoms as strings. */
|
/** Get the atoms as strings. */
|
||||||
#define ATOM_CHAR( x ) # x
|
#define ATOM_CHAR(x) #x
|
||||||
|
|
||||||
/** Atoms we want to pre-load */
|
/** Atoms we want to pre-load */
|
||||||
#define EWMH_ATOMS( X ) \
|
#define EWMH_ATOMS(X) \
|
||||||
X ( _NET_WM_WINDOW_OPACITY ), \
|
X(_NET_WM_WINDOW_OPACITY), X(I3_SOCKET_PATH), X(UTF8_STRING), X(STRING), \
|
||||||
X ( I3_SOCKET_PATH ), \
|
X(CLIPBOARD), X(WM_WINDOW_ROLE), X(_XROOTPMAP_ID), X(_MOTIF_WM_HINTS), \
|
||||||
X ( UTF8_STRING ), \
|
X(WM_TAKE_FOCUS), X(ESETROOT_PMAP_ID)
|
||||||
X ( STRING ), \
|
|
||||||
X ( CLIPBOARD ), \
|
|
||||||
X ( WM_WINDOW_ROLE ), \
|
|
||||||
X ( _XROOTPMAP_ID ), \
|
|
||||||
X ( _MOTIF_WM_HINTS ), \
|
|
||||||
X ( WM_TAKE_FOCUS ), \
|
|
||||||
X ( ESETROOT_PMAP_ID )
|
|
||||||
|
|
||||||
/** enumeration of the atoms. */
|
/** enumeration of the atoms. */
|
||||||
enum { EWMH_ATOMS ( ATOM_ENUM ), NUM_NETATOMS };
|
enum { EWMH_ATOMS(ATOM_ENUM), NUM_NETATOMS };
|
||||||
/** atoms as string */
|
/** atoms as string */
|
||||||
extern const char *netatom_names[];
|
extern const char *netatom_names[];
|
||||||
/** atoms */
|
/** atoms */
|
||||||
|
@ -97,8 +91,7 @@ extern xcb_atom_t netatoms[NUM_NETATOMS];
|
||||||
/**
|
/**
|
||||||
* Structure describing a workarea/monitor.
|
* Structure describing a workarea/monitor.
|
||||||
*/
|
*/
|
||||||
typedef struct _workarea
|
typedef struct _workarea {
|
||||||
{
|
|
||||||
/** numeric monitor id. */
|
/** numeric monitor id. */
|
||||||
int monitor_id;
|
int monitor_id;
|
||||||
/** if monitor is set as primary monitor. */
|
/** if monitor is set as primary monitor. */
|
||||||
|
@ -125,19 +118,19 @@ typedef struct _workarea
|
||||||
*
|
*
|
||||||
* @returns TRUE if monitor is found, FALSE if no monitor could be detected.
|
* @returns TRUE if monitor is found, FALSE if no monitor could be detected.
|
||||||
*/
|
*/
|
||||||
int monitor_active ( workarea *mon );
|
int monitor_active(workarea *mon);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param w rofis window
|
* @param w rofis window
|
||||||
*
|
*
|
||||||
* Stores old input focus for reverting and set focus to rofi.
|
* Stores old input focus for reverting and set focus to rofi.
|
||||||
*/
|
*/
|
||||||
void rofi_xcb_set_input_focus ( xcb_window_t w );
|
void rofi_xcb_set_input_focus(xcb_window_t w);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IF set, revert the focus back to the original applications.
|
* IF set, revert the focus back to the original applications.
|
||||||
*/
|
*/
|
||||||
void rofi_xcb_revert_input_focus ( void );
|
void rofi_xcb_revert_input_focus(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Depth of visual
|
* Depth of visual
|
||||||
|
@ -157,7 +150,7 @@ extern xcb_colormap_t map;
|
||||||
*
|
*
|
||||||
* @returns a cairo surface with the background image of the desktop.
|
* @returns a cairo surface with the background image of the desktop.
|
||||||
*/
|
*/
|
||||||
cairo_surface_t * x11_helper_get_bg_surface ( void );
|
cairo_surface_t *x11_helper_get_bg_surface(void);
|
||||||
/**
|
/**
|
||||||
* Gets a surface for the root window of the desktop.
|
* Gets a surface for the root window of the desktop.
|
||||||
*
|
*
|
||||||
|
@ -165,7 +158,7 @@ cairo_surface_t * x11_helper_get_bg_surface ( void );
|
||||||
*
|
*
|
||||||
* @returns a cairo surface for the root window of the desktop.
|
* @returns a cairo surface for the root window of the desktop.
|
||||||
*/
|
*/
|
||||||
cairo_surface_t *x11_helper_get_screenshot_surface ( void );
|
cairo_surface_t *x11_helper_get_screenshot_surface(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param window The X11 window to modify
|
* @param window The X11 window to modify
|
||||||
|
@ -173,13 +166,12 @@ cairo_surface_t *x11_helper_get_screenshot_surface ( void );
|
||||||
* Set the right hints to disable the window decoration.
|
* Set the right hints to disable the window decoration.
|
||||||
* (Set MOTIF_WM_HINTS, decoration field)
|
* (Set MOTIF_WM_HINTS, decoration field)
|
||||||
*/
|
*/
|
||||||
void x11_disable_decoration ( xcb_window_t window );
|
void x11_disable_decoration(xcb_window_t window);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of cursor types.
|
* List of cursor types.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Default arrow cursor */
|
/** Default arrow cursor */
|
||||||
CURSOR_DEFAULT = 0,
|
CURSOR_DEFAULT = 0,
|
||||||
/** Cursor denoting a clickable area */
|
/** Cursor denoting a clickable area */
|
||||||
|
@ -195,13 +187,12 @@ typedef enum
|
||||||
*
|
*
|
||||||
* Change mouse cursor
|
* Change mouse cursor
|
||||||
*/
|
*/
|
||||||
void x11_set_cursor ( xcb_window_t window, X11CursorType type );
|
void x11_set_cursor(xcb_window_t window, X11CursorType type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of window managers that need different behaviour to functioning.
|
* List of window managers that need different behaviour to functioning.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Default EWHM compatible window manager */
|
/** Default EWHM compatible window manager */
|
||||||
WM_EWHM = 0,
|
WM_EWHM = 0,
|
||||||
/** I3 Window manager */
|
/** I3 Window manager */
|
||||||
|
@ -224,9 +215,11 @@ extern WindowManagerQuirk current_window_manager;
|
||||||
*
|
*
|
||||||
* Creates a thumbnail of the window.
|
* Creates a thumbnail of the window.
|
||||||
*
|
*
|
||||||
* @returns NULL if window was not found, or unmapped, otherwise returns a cairo_surface.
|
* @returns NULL if window was not found, or unmapped, otherwise returns a
|
||||||
|
* cairo_surface.
|
||||||
*/
|
*/
|
||||||
cairo_surface_t *x11_helper_get_screenshot_surface_window ( xcb_window_t window, int size );
|
cairo_surface_t *x11_helper_get_screenshot_surface_window(xcb_window_t window,
|
||||||
|
int size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param surface
|
* @param surface
|
||||||
|
@ -235,6 +228,7 @@ cairo_surface_t *x11_helper_get_screenshot_surface_window ( xcb_window_t window,
|
||||||
*
|
*
|
||||||
* Blur the content of the surface with radius and deviation.
|
* Blur the content of the surface with radius and deviation.
|
||||||
*/
|
*/
|
||||||
void cairo_image_surface_blur ( cairo_surface_t* surface, double radius, double deviation );
|
void cairo_image_surface_blur(cairo_surface_t *surface, double radius,
|
||||||
|
double deviation);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,20 +27,22 @@
|
||||||
|
|
||||||
#ifndef ROFI_XRMOPTIONS_H
|
#ifndef ROFI_XRMOPTIONS_H
|
||||||
#define ROFI_XRMOPTIONS_H
|
#define ROFI_XRMOPTIONS_H
|
||||||
#include "xcb.h"
|
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
#include "xcb.h"
|
||||||
// Big thanks to Sean Pringle for this code.
|
// Big thanks to Sean Pringle for this code.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup CONFXResources XResources Configuration
|
* @defgroup CONFXResources XResources Configuration
|
||||||
* @ingroup CONFIGURATION
|
* @ingroup CONFIGURATION
|
||||||
*
|
*
|
||||||
* Configuration described in Xresource format. This can be loaded from the X server or file.
|
* Configuration described in Xresource format. This can be loaded from the X
|
||||||
|
* server or file.
|
||||||
*
|
*
|
||||||
* @defgroup CONFXServer XServer Configuration
|
* @defgroup CONFXServer XServer Configuration
|
||||||
* @ingroup CONFXResources
|
* @ingroup CONFXResources
|
||||||
*
|
*
|
||||||
* Loads the configuration directly from the X server using the XResources system.
|
* Loads the configuration directly from the X server using the XResources
|
||||||
|
* system.
|
||||||
*
|
*
|
||||||
* @defgroup CONFCommandline Commandline Configuration
|
* @defgroup CONFCommandline Commandline Configuration
|
||||||
* @ingroup CONFIGURATION
|
* @ingroup CONFIGURATION
|
||||||
|
@ -50,7 +52,8 @@
|
||||||
* @defgroup CONFFile File Configuration
|
* @defgroup CONFFile File Configuration
|
||||||
* @ingroup CONFXResources
|
* @ingroup CONFXResources
|
||||||
*
|
*
|
||||||
* Loads the configuration from a config file that uses the XResource file format.
|
* Loads the configuration from a config file that uses the XResource file
|
||||||
|
* format.
|
||||||
*
|
*
|
||||||
* @defgroup CONFIGURATION Configuration
|
* @defgroup CONFIGURATION Configuration
|
||||||
*
|
*
|
||||||
|
@ -66,8 +69,7 @@
|
||||||
/**
|
/**
|
||||||
* Type of the config options.
|
* Type of the config options.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
/** Config option is string */
|
/** Config option is string */
|
||||||
xrm_String = 0,
|
xrm_String = 0,
|
||||||
/** Config option is an unsigned number */
|
/** Config option is an unsigned number */
|
||||||
|
@ -84,14 +86,14 @@ typedef enum
|
||||||
* Parse commandline options.
|
* Parse commandline options.
|
||||||
* @ingroup CONFCommandline
|
* @ingroup CONFCommandline
|
||||||
*/
|
*/
|
||||||
void config_parse_cmd_options ( void );
|
void config_parse_cmd_options(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free any allocated memory.
|
* Free any allocated memory.
|
||||||
*
|
*
|
||||||
* @ingroup CONFXResources
|
* @ingroup CONFXResources
|
||||||
*/
|
*/
|
||||||
void config_xresource_free ( void );
|
void config_xresource_free(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param type The type of the value
|
* @param type The type of the value
|
||||||
|
@ -101,12 +103,14 @@ void config_xresource_free ( void );
|
||||||
*
|
*
|
||||||
* Add option (at runtime) to the dynamic option parser.
|
* Add option (at runtime) to the dynamic option parser.
|
||||||
*/
|
*/
|
||||||
void config_parser_add_option ( XrmOptionType type, const char *key, void **value, const char *comment );
|
void config_parser_add_option(XrmOptionType type, const char *key, void **value,
|
||||||
|
const char *comment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print the current configuration to stdout. Uses bold/italic when printing to terminal.
|
* Print the current configuration to stdout. Uses bold/italic when printing to
|
||||||
|
* terminal.
|
||||||
*/
|
*/
|
||||||
void print_options ( void );
|
void print_options(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param option The name of the option
|
* @param option The name of the option
|
||||||
|
@ -117,7 +121,8 @@ void print_options ( void );
|
||||||
*
|
*
|
||||||
* Function that does the markup for printing an configuration option to stdout.
|
* Function that does the markup for printing an configuration option to stdout.
|
||||||
*/
|
*/
|
||||||
void print_help_msg ( const char *option, const char *type, const char*text, const char *def, int isatty );
|
void print_help_msg(const char *option, const char *type, const char *text,
|
||||||
|
const char *def, int isatty);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param length the length of the returned array
|
* @param length the length of the returned array
|
||||||
|
@ -126,7 +131,7 @@ void print_help_msg ( const char *option, const char *type, const char*text, con
|
||||||
*
|
*
|
||||||
* @returns an array of string with length elements
|
* @returns an array of string with length elements
|
||||||
*/
|
*/
|
||||||
char ** config_parser_return_display_help ( unsigned int *length );
|
char **config_parser_return_display_help(unsigned int *length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set config option.
|
* @brief Set config option.
|
||||||
|
@ -138,7 +143,7 @@ char ** config_parser_return_display_help ( unsigned int *length );
|
||||||
*
|
*
|
||||||
* @returns true when failed to set property.
|
* @returns true when failed to set property.
|
||||||
*/
|
*/
|
||||||
gboolean config_parse_set_property ( const Property *p, char **error );
|
gboolean config_parse_set_property(const Property *p, char **error);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param out The destination.
|
* @param out The destination.
|
||||||
|
@ -146,6 +151,6 @@ gboolean config_parse_set_property ( const Property *p, char **error );
|
||||||
*
|
*
|
||||||
* @brief Dump configuration in rasi format.
|
* @brief Dump configuration in rasi format.
|
||||||
*/
|
*/
|
||||||
void config_parse_dump_config_rasi_format ( FILE *out, gboolean changes );
|
void config_parse_dump_config_rasi_format(FILE *out, gboolean changes);
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue