Add some comments, rename.

This commit is contained in:
QC 2015-02-09 20:05:30 +01:00
parent f6bc8f7c32
commit 67cbd48c8b
3 changed files with 19 additions and 5 deletions

View File

@ -183,8 +183,22 @@ void release_keyboard ( Display *display );
*/
int take_keyboard ( Display *display, Window w );
/**
* @param display Connection to the X server.
* @param modmask Modifier mask.
* @param key Key.
*
* Grab key on display.
*/
void x11_grab_key ( Display *display, unsigned int modmask, KeySym key );
void grab_key ( Display *display, unsigned int modmask, KeySym key );
/**
* @param combo String representing the key combo
* @param mod [out] The modifier specified (or AnyModifier if not specified)
* @param key [out] The key specified
*
* Parse key from user input string.
*/
void x11_parse_key ( char *combo, unsigned int *mod, KeySym *key );
/**

View File

@ -2034,17 +2034,17 @@ int main ( int argc, char *argv[] )
// Daemon mode, Listen to key presses..
if ( switcher_get ( "window" ) >= 0 ) {
x11_parse_key ( config.window_key, &windows_modmask, &windows_keysym );
grab_key ( display, windows_modmask, windows_keysym );
x11_grab_key ( display, windows_modmask, windows_keysym );
}
if ( switcher_get ( "run" ) >= 0 ) {
x11_parse_key ( config.run_key, &rundialog_modmask, &rundialog_keysym );
grab_key ( display, rundialog_modmask, rundialog_keysym );
x11_grab_key ( display, rundialog_modmask, rundialog_keysym );
}
if ( switcher_get ( "ssh" ) >= 0 ) {
x11_parse_key ( config.ssh_key, &sshdialog_modmask, &sshdialog_keysym );
grab_key ( display, sshdialog_modmask, sshdialog_keysym );
x11_grab_key ( display, sshdialog_modmask, sshdialog_keysym );
}
// Setup handler for sighub (reload config)

View File

@ -398,7 +398,7 @@ void release_keyboard ( Display *display )
XUngrabKeyboard ( display, CurrentTime );
}
// bind a key combination on a root window, compensating for Lock* states
void grab_key ( Display *display, unsigned int modmask, KeySym key )
void x11_grab_key ( Display *display, unsigned int modmask, KeySym key )
{
Screen *screen = DefaultScreenOfDisplay ( display );
Window root = RootWindow ( display, XScreenNumberOfScreen ( screen ) );