summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Udaltsov <svu@gnome.org>2006-02-15 00:37:11 +0000
committerSergey Udaltsov <svu@gnome.org>2006-02-15 00:37:11 +0000
commit8b4a18460dcd156154a981b7999fd9225e931b5f (patch)
tree25207cde4bdd3579d04a611080b7486405c8056a
parentbcdcd8caa33f77c33ee6949bd7c67db90524cd55 (diff)
downloadlibxklavier-8b4a18460dcd156154a981b7999fd9225e931b5f.tar.gz
some polishing on names
-rw-r--r--libxklavier/xklavier.c40
-rw-r--r--libxklavier/xklavier.h58
-rw-r--r--libxklavier/xklavier_evt.c14
-rw-r--r--libxklavier/xklavier_private.h79
-rw-r--r--libxklavier/xklavier_private_xkb.h14
-rw-r--r--libxklavier/xklavier_xkb.c20
6 files changed, 116 insertions, 109 deletions
diff --git a/libxklavier/xklavier.c b/libxklavier/xklavier.c
index f1ae94e..3756c4c 100644
--- a/libxklavier/xklavier.c
+++ b/libxklavier/xklavier.c
@@ -185,7 +185,7 @@ gint xkl_start_listen( guint what )
xkl_debug( 0, "The backend does not require manual layout management - "
"but it is provided by the application" );
- xkl_resume_listen( );
+ xkl_listen_resume( );
xkl_load_window_tree( );
XFlush( xkl_display );
return 0;
@@ -193,7 +193,7 @@ gint xkl_start_listen( guint what )
gint xkl_stop_listen( void )
{
- xkl_pause_listen( );
+ xkl_listen_pause( );
return 0;
}
@@ -253,7 +253,7 @@ gint xkl_init( Display * a_dpy )
if( rv == 0 )
{
xkl_debug( 150, "Actual backend: %s\n",
- xkl_get_backend_name() );
+ xkl_backend_get_name() );
}
else
{
@@ -320,12 +320,12 @@ gboolean xkl_ungrab_key( gint keycode, guint modifiers )
gint _xkl_get_next_group( void )
{
- return ( xkl_current_state.group + 1 ) % xkl_get_num_groups( );
+ return ( xkl_current_state.group + 1 ) % xkl_groups_get_num( );
}
gint xkl_get_prev_group( void )
{
- gint n = xkl_get_num_groups( );
+ gint n = xkl_groups_get_num( );
return ( xkl_current_state.group + n - 1 ) % n;
}
@@ -335,7 +335,7 @@ gint xkl_get_restore_group( void )
if( xkl_current_client == ( Window ) NULL )
{
xkl_debug( 150, "cannot restore without current client\n" );
- } else if( xkl_get_state( xkl_current_client, &state ) )
+ } else if( xkl_state_get( xkl_current_client, &state ) )
{
return state.group;
} else
@@ -479,8 +479,8 @@ void xkl_try_call_state_func( XklStateChange change_type,
!xkl_is_one_switch_to_secondary_group_allowed() )
{
xkl_debug( 150, "secondary -> go next\n" );
- group = xkl_get_next_group( );
- xkl_lock_group( group );
+ group = xkl_group_get_next( );
+ xkl_group_lock( group );
return; /* we do not need to revalidate */
}
}
@@ -530,35 +530,35 @@ void xkl_reset_all_info( const gchar reason[] )
/**
* Calling through vtable
*/
-const gchar **xkl_get_group_names( void )
+const gchar **xkl_groups_get_names( void )
{
xkl_ensure_vtable_inited();
- return (*xkl_vtable->get_group_names_func)();
+ return (*xkl_vtable->groups_get_names_func)();
}
-guint _xkl_get_num_groups( void )
+guint _xkl_groups_get_num( void )
{
xkl_ensure_vtable_inited();
- return (*xkl_vtable->get_num_groups_func)();
+ return (*xkl_vtable->groups_get_num_func)();
}
-void xkl_lock_group( int group )
+void xkl_group_lock( int group )
{
xkl_ensure_vtable_inited();
- (*xkl_vtable->lock_group_func)( group );
+ (*xkl_vtable->group_lock_func)( group );
}
-gint xkl_pause_listen( void )
+gint xkl_listen_pause( void )
{
xkl_ensure_vtable_inited();
- return (*xkl_vtable->pause_listen_func)();
+ return (*xkl_vtable->listen_pause_func)();
}
-gint xkl_resume_listen( void )
+gint xkl_listen_resume( void )
{
xkl_ensure_vtable_inited();
xkl_debug( 150, "listenerType: %x\n", xkl_listener_type );
- if( (*xkl_vtable->resume_listen_func)() )
+ if( (*xkl_vtable->listen_resume_func)() )
return 1;
xkl_select_input_merging( xkl_root_window,
@@ -580,9 +580,9 @@ void xkl_free_all_info( void )
(*xkl_vtable->free_all_info_func)();
}
-guint xkl_get_max_num_groups( void )
+guint xkl_groups_get_max_num( void )
{
xkl_ensure_vtable_inited();
- return (*xkl_vtable->get_max_num_groups_func)();
+ return (*xkl_vtable->groups_get_max_num_func)();
}
diff --git a/libxklavier/xklavier.h b/libxklavier/xklavier.h
index 677f6d2..83c1737 100644
--- a/libxklavier/xklavier.h
+++ b/libxklavier/xklavier.h
@@ -92,14 +92,14 @@ extern "C"
* What kind of backend if used
* @return some string id of the backend
*/
- extern const gchar *xkl_get_backend_name( void );
+ extern const gchar *xkl_backend_get_name( void );
/**
* Provides information regarding available backend features
* (combination of XKLF_* constants)
* @return ORed XKLF_* constants
*/
- extern guint xkl_get_backend_features( void );
+ extern guint xkl_backend_get_features( void );
/**
* Provides the information on maximum number of simultaneously supported
@@ -107,7 +107,7 @@ extern "C"
* @return maximum number of the groups in configuration,
* 0 if no restrictions.
*/
- extern unsigned xkl_get_max_num_groups( void );
+ extern unsigned xkl_groups_get_max_num( void );
/** @} */
/**
@@ -137,25 +137,25 @@ extern "C"
* @param what any combination of XKLL_* constants
* @return 0
*/
- extern gint xkl_start_listen( guint what );
+ extern gint xkl_listen_start( guint what );
/**
* Stops listening for XKB-related events
* @return 0
*/
- extern gint xkl_stop_listen( void );
+ extern gint xkl_listen_stop( void );
/**
* Temporary pauses listening for XKB-related events
* @return 0
*/
- extern gint xkl_pause_listen( void );
+ extern gint xkl_listen_pause( void );
/**
* Resumes listening for XKB-related events
* @return 0
*/
- extern gint xkl_resume_listen( void );
+ extern gint xkl_listen_resume( void );
/**
* Grabs some key
@@ -163,7 +163,7 @@ extern "C"
* @param modifiers is a bitmask of modifiers
* @return True on success
*/
- extern gboolean xkl_grab_key( gint keycode, unsigned modifiers );
+ extern gboolean xkl_key_grab( gint keycode, unsigned modifiers );
/**
* Ungrabs some key
@@ -171,7 +171,7 @@ extern "C"
* @param modifiers is a bitmask of modifiers
* @return True on success
*/
- extern gboolean xkl_ungrab_key( gint keycode, unsigned modifiers );
+ extern gboolean xkl_key_ungrab( gint keycode, unsigned modifiers );
/**
* Processes X events. Should be included into the main event cycle of an
@@ -180,12 +180,12 @@ extern "C"
* @return 0 if the event it processed - 1 otherwise
* @see xkl_StartListen
*/
- extern gint xkl_filter_events( XEvent * evt );
+ extern gint xkl_events_filter( XEvent * evt );
/**
* Allows to switch (once) to the secondary group
*/
- extern void xkl_allow_one_switch_to_secondary_group( void );
+ extern void xkl_group_allow_one_switch_to_secondary( void );
/** @} */
@@ -197,13 +197,13 @@ extern "C"
/**
* @return currently focused window
*/
- extern Window xkl_get_current_window( void );
+ extern Window xkl_window_get_current( void );
/**
* @return current state of the keyboard (in XKB terms).
* Returned value is a statically allocated buffer, should not be freed.
*/
- extern XklState *xkl_get_current_state( void );
+ extern XklState *xkl_state_get_current( void );
/** @} */
@@ -216,7 +216,7 @@ extern "C"
* @return the window title of some window or NULL.
* If not NULL, it should be freed with XFree
*/
- extern gchar *xkl_get_window_title( Window w );
+ extern gchar *xkl_window_get_title( Window w );
/**
* Finds the state for a given window (for its "App window").
@@ -225,20 +225,20 @@ extern "C"
* @return True on success, otherwise False
* (the error message can be obtained using xkl_GetLastError).
*/
- extern gboolean xkl_get_state( Window win, XklState * state_return );
+ extern gboolean xkl_state_get( Window win, XklState * state_return );
/**
* Drops the state of a given window (of its "App window").
* @param win is a target window
*/
- extern void xkl_delete_state( Window win );
+ extern void xkl_state_delete( Window win );
/**
* Stores ths state for a given window
* @param win is a target window
* @param state is a new state of the window
*/
- extern void xkl_save_state( Window win, XklState * state );
+ extern void xkl_state_save( Window win, XklState * state );
/**
* Sets the "transparent" flag. It means focus switching onto
@@ -247,14 +247,14 @@ extern "C"
* @param transparent - if true, the windows is transparent.
* @see xkl_IsTranspatent
*/
- extern void xkl_set_transparent( Window win, gboolean transparent );
+ extern void xkl_window_set_transparent( Window win, gboolean transparent );
/**
* Returns "transparent" flag.
* @param win is the window to get the transparent flag from.
* @see xkl_SetTranspatent
*/
- extern gboolean xkl_is_transparent( Window win );
+ extern gboolean xkl_window_is_transparent( Window win );
/**
* Checks whether 2 windows have the same topmost window
@@ -262,7 +262,7 @@ extern "C"
* @param win2 is second window
* @return True is windows are in the same application
*/
- extern gboolean xkl_is_same_appication( Window win1, Window win2 );
+ extern gboolean xkl_windows_is_same_appication( Window win1, Window win2 );
/** @} */
@@ -275,21 +275,21 @@ extern "C"
* @return the total number of groups in the current XKB configuration
* (keyboard)
*/
- extern unsigned xkl_get_num_groups( void );
+ extern unsigned xkl_groups_get_num( void );
/**
* @return the array of group names for the current XKB configuration
* (keyboard).
* This array is static, should not be freed
*/
- extern const gchar **xkl_get_group_names( void );
+ extern const gchar **xkl_groups_get_names( void );
/**
* @return the array of indicator names for the current XKB configuration
* (keyboard).
* This array is static, should not be freed
*/
- extern const gchar **xkl_get_indicator_names( void );
+ extern const gchar **xkl_indicators_get_names( void );
/** @} */
@@ -302,19 +302,19 @@ extern "C"
* Calculates next group id. Does not change the state of anything.
* @return next group id
*/
- extern gint xkl_get_next_group( void );
+ extern gint xkl_group_get_next( void );
/**
* Calculates prev group id. Does not change the state of anything.
* @return prev group id
*/
- extern gint xkl_get_prev_group( void );
+ extern gint xkl_group_get_prev( void );
/**
* @return saved group id of the current client.
* Does not change the state of anything.
*/
- extern gint xkl_get_restore_group( void );
+ extern gint xkl_group_get_restore( void );
/**
* Locks the group. Can be used after xkl_GetXXXGroup functions
@@ -323,7 +323,7 @@ extern "C"
* @see xkl_GetPrevGroup
* @see xkl_GetRestoreGroup
*/
- extern void xkl_lock_group( gint group );
+ extern void xkl_group_lock( gint group );
/** @} */
@@ -439,14 +439,14 @@ extern "C"
* If -1, no default group is used
* @param group the default group
*/
- extern void xkl_set_default_group( gint group );
+ extern void xkl_group_set_default( gint group );
/**
* Returns the default group set on window creation
* If -1, no default group is used
* @return the default group
*/
- extern gint xkl_get_default_group( void );
+ extern gint xkl_group_get_default( void );
/** @} */
diff --git a/libxklavier/xklavier_evt.c b/libxklavier/xklavier_evt.c
index 1a209f7..def2e47 100644
--- a/libxklavier/xklavier_evt.c
+++ b/libxklavier/xklavier_evt.c
@@ -91,7 +91,7 @@ void xkl_process_focus_in_evt( XFocusChangeEvent * fev )
xkl_debug( 150, "Appwin " WINID_FORMAT ", '%s' has got focus\n",
toplevel_win, xkl_get_debug_window_title( toplevel_win ) );
- if( xkl_get_state( toplevel_win, &selected_window_state ) )
+ if( xkl_state_get( toplevel_win, &selected_window_state ) )
{
if( xkl_current_client != toplevel_win )
{
@@ -108,7 +108,7 @@ void xkl_process_focus_in_evt( XFocusChangeEvent * fev )
* the _previous_ window.
*/
if ( !old_win_transparent &&
- xkl_get_state ( xkl_current_client, &tmp_state ) )
+ xkl_state_get( xkl_current_client, &tmp_state ) )
{
xkl_update_current_state( tmp_state.group,
tmp_state.indicators,
@@ -156,7 +156,7 @@ void xkl_process_focus_in_evt( XFocusChangeEvent * fev )
xkl_update_current_state( selected_window_state.group,
selected_window_state.indicators,
"Enforcing fast update of the current state" );
- xkl_lock_group( selected_window_state.group );
+ xkl_group_lock( selected_window_state.group );
} else
{
xkl_debug( 150,
@@ -175,7 +175,7 @@ void xkl_process_focus_in_evt( XFocusChangeEvent * fev )
xkl_current_state.indicators,
selected_window_state.indicators );
xkl_ensure_vtable_inited();
- (*xkl_vtable->set_indicators_func)( &selected_window_state );
+ (*xkl_vtable->indicators_set_func)( &selected_window_state );
} else
xkl_debug( 150,
"Not restoring the indicators %X after gaining focus: indicator handling is not enabled\n",
@@ -223,7 +223,7 @@ void xkl_process_focus_out_evt( XFocusChangeEvent * fev )
xkl_debug( 160, "Window " WINID_FORMAT ", '%s' has lost focus\n",
fev->window, xkl_get_debug_window_title( fev->window ) );
- if( xkl_is_transparent( fev->window ) )
+ if( xkl_window_is_transparent( fev->window ) )
{
xkl_debug( 150, "Leaving transparent window!\n" );
/**
@@ -268,7 +268,7 @@ void xkl_provess_property_evt( XPropertyEvent * pev )
{
if( pev->atom == xkl_atoms[WM_STATE] )
{
- gboolean has_xkl_state = xkl_get_state( pev->window, NULL );
+ gboolean has_xkl_state = xkl_state_get( pev->window, NULL );
if( pev->state == PropertyNewValue )
{
@@ -286,7 +286,7 @@ void xkl_provess_property_evt( XPropertyEvent * pev )
xkl_select_input_merging( pev->window, PropertyChangeMask );
if( has_xkl_state )
{
- xkl_delete_state( pev->window );
+ xkl_state_delete( pev->window );
}
}
} else
diff --git a/libxklavier/xklavier_private.h b/libxklavier/xklavier_private.h
index 25ffdfc..cad17c1 100644
--- a/libxklavier/xklavier_private.h
+++ b/libxklavier/xklavier_private.h
@@ -5,6 +5,7 @@
#include <libxklavier/xklavier_config.h>
+/* XklConfigRec */
typedef gboolean ( *XklVTConfigActivateFunc )( const XklConfigRec * data );
typedef void ( *XklVTConfigInitFunc )( void );
@@ -15,27 +16,29 @@ typedef gboolean ( *XklVTConfigWriteFileFunc )( const gchar *file_name,
const XklConfigRec * data,
const gboolean binary );
-typedef gint ( *XklVTEventFunc )( XEvent *xev );
+/* Groups */
+typedef const gchar **( *XklVTGroupsGetNamesFunc )( void );
-typedef void ( *XklVTFreeAllInfoFunc )( void );
+typedef gint ( *XklVTGroupsGetMaxNumFunc )( void );
-typedef const gchar **( *XklVTGetGroupNamesFunc )( void );
+typedef gint ( *XklVTGroupsGetNumFunc )( void );
-typedef gint ( *XklVTGetMaxNumGroupsFunc )( void );
+typedef void ( *XklVTGroupLockFunc )( gint group );
-typedef gint ( *XklVTGetNumGroupsFunc )( void );
-typedef void ( *XklVTGetServerStateFunc)( XklState * current_state_out );
+typedef gint ( *XklVTEventFunc )( XEvent *xev );
+
+typedef void ( *XklVTFreeAllInfoFunc )( void );
typedef gboolean ( *XklVTIfCachedInfoEqualsActualFunc) ( void );
typedef gboolean ( *XklVTLoadAllInfoFunc )( void );
-typedef void ( *XklVTLockGroupFunc )( gint group );
+typedef void ( *XklVTGetServerStateFunc)( XklState * current_state_out );
typedef gint ( *XklVTPauseResumeListenFunc )( void );
-typedef void ( *XklVTSetIndicatorsFunc )( const XklState *window_state );
+typedef void ( *XklVTIndicatorsSetFunc )( const XklState *window_state );
typedef struct
{
@@ -79,47 +82,50 @@ typedef struct
*/
XklVTConfigWriteFileFunc config_write_file_func;
- /**
- * Handles X events.
- * xkb: XkbEvent handling
- * xmodmap: keep track on the root window properties. What else can we do?
- */
- XklVTEventFunc event_func;
-
- /**
- * Flushes the cached server config info.
- * xkb: frees XkbDesc
- * xmodmap: frees internal XklConfigRec
- */
- XklVTFreeAllInfoFunc free_all_info_func; /* private */
/**
* Get the list of the group names
* xkb: return cached list of the group names
* xmodmap: return the list of layouts from the internal XklConfigRec
*/
- XklVTGetGroupNamesFunc get_group_names_func;
+ XklVTGroupsGetNamesFunc groups_get_names_func;
/**
* Get the maximum number of loaded groups
* xkb: returns 1 or XkbNumKbdGroups
* xmodmap: return 0
*/
- XklVTGetMaxNumGroupsFunc get_max_num_groups_func;
+ XklVTGroupsGetMaxNumFunc groups_get_max_num_func;
/**
* Get the number of loaded groups
* xkb: return from the cached XkbDesc
* xmodmap: return number of layouts from internal XklConfigRec
*/
- XklVTGetNumGroupsFunc get_num_groups_func;
+ XklVTGroupsGetNumFunc groups_get_num_func;
/**
- * Gets the current stateCallback
- * xkb: XkbGetState and XkbGetIndicatorState
- * xmodmap: check the root window property (regarding the group)
+ * Switches the keyboard to the group N
+ * xkb: simple one-liner to call the XKB function
+ * xmodmap: changes the root window property
+ * (listener invokes xmodmap with appropriate config file).
*/
- XklVTGetServerStateFunc get_server_state_func;
+ XklVTGroupLockFunc group_lock_func;
+
+
+ /**
+ * Handles X events.
+ * xkb: XkbEvent handling
+ * xmodmap: keep track on the root window properties. What else can we do?
+ */
+ XklVTEventFunc event_func;
+
+ /**
+ * Flushes the cached server config info.
+ * xkb: frees XkbDesc
+ * xmodmap: frees internal XklConfigRec
+ */
+ XklVTFreeAllInfoFunc free_all_info_func; /* private */
/**
* Compares the cached info with the actual one, from the server
@@ -136,33 +142,32 @@ typedef struct
XklVTLoadAllInfoFunc load_all_info_func; /* private */
/**
- * Switches the keyboard to the group N
- * xkb: simple one-liner to call the XKB function
- * xmodmap: changes the root window property
- * (listener invokes xmodmap with appropriate config file).
+ * Gets the current stateCallback
+ * xkb: XkbGetState and XkbGetIndicatorState
+ * xmodmap: check the root window property (regarding the group)
*/
- XklVTLockGroupFunc lock_group_func;
+ XklVTGetServerStateFunc get_server_state_func;
/**
* Stop tracking the keyboard-related events
* xkb: XkbSelectEvents(..., 0)
* xmodmap: Ungrab the switching shortcut.
*/
- XklVTPauseResumeListenFunc pause_listen_func;
+ XklVTPauseResumeListenFunc listen_pause_func;
/**
* Start tracking the keyboard-related events
* xkb: XkbSelectEvents + XkbSelectEventDetails
* xmodmap: Grab the switching shortcut.
*/
- XklVTPauseResumeListenFunc resume_listen_func;
+ XklVTPauseResumeListenFunc listen_resume_func;
/**
* Set the indicators state from the XklState
* xkb: XklSetIndicator for all indicators
* xmodmap: NULL. Not supported
*/
- XklVTSetIndicatorsFunc set_indicators_func; /* private */
+ XklVTIndicatorsSetFunc indicators_set_func; /* private */
/* all data is private - no direct access */
/**
@@ -253,7 +258,7 @@ extern Status xkl_status_query_tree( Display * display,
Window ** children_out,
guint *nchildren_out );
-extern gboolean xkl_set_indicator( gint indicator_num, gboolean set );
+extern gboolean xkl_indicator_set( gint indicator_num, gboolean set );
extern void xkl_try_call_state_func( XklStateChange change_type,
XklState * old_state );
diff --git a/libxklavier/xklavier_private_xkb.h b/libxklavier/xklavier_private_xkb.h
index faa5b58..dacbbc2 100644
--- a/libxklavier/xklavier_private_xkb.h
+++ b/libxklavier/xklavier_private_xkb.h
@@ -44,11 +44,11 @@ extern gint xkl_xkb_event_func( XEvent * kev );
extern void xkl_xkb_free_all_info( void );
-extern const gchar **xkl_xkb_get_group_names( void );
+extern const gchar **xkl_xkb_groups_get_names( void );
-extern gint xkl_xkb_get_max_num_groups( void );
+extern gint xkl_xkb_groups_get_max_num( void );
-extern gint xkl_xkb_get_num_groups( void );
+extern gint xkl_xkb_groups_get_num( void );
extern void xkl_xkb_get_server_state( XklState * current_state_out );
@@ -56,13 +56,13 @@ extern gboolean xkl_xkb_if_cached_info_equals_actual( void );
extern gboolean xkl_xkb_load_all_info( void );
-extern void xkl_xkb_lock_group( gint group );
+extern void xkl_xkb_group_lock( gint group );
-extern gint xkl_xkb_pause_listen( void );
+extern gint xkl_xkb_listen_pause( void );
-extern gint xkl_xkb_resume_listen( void );
+extern gint xkl_xkb_listen_resume( void );
-extern void xkl_xkb_set_indicators( const XklState *window_state );
+extern void xkl_xkb_indicators_set( const XklState *window_state );
/* End of VTable methods */
diff --git a/libxklavier/xklavier_xkb.c b/libxklavier/xklavier_xkb.c
index b6a8313..922b3e3 100644
--- a/libxklavier/xklavier_xkb.c
+++ b/libxklavier/xklavier_xkb.c
@@ -401,7 +401,7 @@ gboolean xkl_set_indicator( gint indicator_num, gboolean set )
group = i;
break;
}
- xkl_lock_group( group );
+ xkl_group_lock( group );
}
}
@@ -456,18 +456,20 @@ gint xkl_xkb_init( void )
xkl_xkb_config_init,
xkl_xkb_config_load_registry,
xkl_xkb_config_write_file,
+
+ xkl_xkb_groups_get_names,
+ xkl_xkb_groups_get_max_num,
+ xkl_xkb_groups_get_num,
+ xkl_xkb_group_lock,
+
xkl_xkb_event_func,
xkl_xkb_free_all_info,
- xkl_xkb_get_group_names,
- xkl_xkb_get_max_num_groups,
- xkl_xkb_get_num_groups,
- xkl_xkb_get_server_state,
xkl_xkb_if_cached_info_equals_actual,
xkl_xkb_load_all_info,
- xkl_xkb_lock_group,
- xkl_xkb_pause_listen,
- xkl_xkb_resume_listen,
- xkl_xkb_set_indicators,
+ xkl_xkb_get_server_state,
+ xkl_xkb_listen_pause,
+ xkl_xkb_listen_resume,
+ xkl_xkb_indicators_set,
};
if( getenv( "XKL_XKB_DISABLE" ) != NULL )