From 73b30883a6046a316969c13751238180933876e9 Mon Sep 17 00:00:00 2001 From: iovar Date: Thu, 15 Nov 2007 11:20:50 +0000 Subject: rmdfunc.h: added RegisterShortcuts declaration, changed PollDamage to PollEvents. rmdmacro.h: Added default values for shortcuts. rmdtypes.h: added HotKey struct type and all members related to shortcuts, on the pdata and args structs. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@434 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/include/rmdfunc.h | 27 +++++++++++++++++++++++++-- recordmydesktop/include/rmdmacro.h | 4 ++++ recordmydesktop/include/rmdtypes.h | 18 ++++++++++++++---- 3 files changed, 43 insertions(+), 6 deletions(-) (limited to 'recordmydesktop') diff --git a/recordmydesktop/include/rmdfunc.h b/recordmydesktop/include/rmdfunc.h index 0a01301..de12ef1 100644 --- a/recordmydesktop/include/rmdfunc.h +++ b/recordmydesktop/include/rmdfunc.h @@ -37,10 +37,11 @@ /** * Loop calling XNextEvent.Retrieve and place on -* list damage events that arive, create damage for new windows. +* list damage events that arive, create damage for new windows +* and pickup key events for shortcuts. * \param pdata ProgData struct containing all program data */ -void *PollDamage(ProgData *pdata); +void *PollEvents(ProgData *pdata); /** * Retrieve frame form xserver, and transform to a yuv buffer, @@ -686,6 +687,28 @@ void BlocksFromList(RectArea **root, void CleanUp(void); +/* + * Check a shortcut combination and if valid, + * register it, on the root window. + * + * \param dpy Connection to the X Server + * + * \param root Root window id + * + * \param shortcut String represantation of the shortcut + * + * \param HotKey Pre-allocated struct that is filled with the + * modifiers and the keycode, for checks on incoming + * keypress events. Left untouched if the call fails. + * + * + * \returns 0 on Success, 1 on Failure. + * + */ +int RegisterShortcut(Display *dpy, + Window root, + const char *shortcut, + HotKey *hotkey); #endif diff --git a/recordmydesktop/include/rmdmacro.h b/recordmydesktop/include/rmdmacro.h index 0d2ecfc..d167675 100644 --- a/recordmydesktop/include/rmdmacro.h +++ b/recordmydesktop/include/rmdmacro.h @@ -228,6 +228,10 @@ (args)->s_quality=10;\ (args)->workdir=(char *)malloc(5);\ strcpy((args)->workdir,"/tmp");\ + (args)->pause_shortcut=(char *)malloc(15);\ + strcpy((args)->pause_shortcut,"Control+Mod1+p");\ + (args)->stop_shortcut=(char *)malloc(15);\ + strcpy((args)->stop_shortcut,"Control+Mod1+s");\ } #define QUERY_DISPLAY_SPECS(display,specstruct){\ diff --git a/recordmydesktop/include/rmdtypes.h b/recordmydesktop/include/rmdtypes.h index e1a5940..45abf82 100644 --- a/recordmydesktop/include/rmdtypes.h +++ b/recordmydesktop/include/rmdtypes.h @@ -165,10 +165,12 @@ typedef struct _ProgArgs{ int v_bitrate,v_quality,s_quality; //video bitrate,video-sound quality int encOnTheFly; //encode while recording, no caching(default 0) char *workdir; //directory to be used for cache files(default $HOME) - int zerocompression;//image data are always flushed uncompressed - int overwrite; //overwite a previously existing file - //(do not add a .number postfix) - int use_jack; //record audio with jack + char *pause_shortcut; //pause/unpause shortcut sequence(Control+Alt+p) + char *stop_shortcut; //stop shortcut sequence(Control+Alt+s) + int zerocompression; //image data are always flushed uncompressed + int overwrite; //overwite a previously existing file + //(do not add a .number postfix) + int use_jack; //record audio with jack unsigned int jack_nports; char **jack_port_names; float jack_ringbuffer_secs; @@ -253,6 +255,12 @@ typedef struct _JackData{ }JackData; #endif +typedef struct _HotKey{ //Hold info about the shortcuts + int modnum; //modnum is the number of modifier masks + unsigned int mask[4]; //that should be checked (the initial + int key; //user requested modifier plus it's +}HotKey; //combinations with LockMask and NumLockMask). + //this structure holds any data related to the program //It's usage is mostly to be given as an argument to the //threads,so they will have access to the program data, avoiding @@ -267,6 +275,8 @@ typedef struct _ProgData{ SndBuffer *sound_buffer; EncData *enc_data; CacheData *cache_data; + HotKey pause_key, //Shortcuts + stop_key; #ifdef HAVE_JACK_H JackData *jdata; #endif -- cgit v1.2.3