~cairo-dock-team/ubuntu/precise/cairo-dock/3.0.0.0beta1

« back to all changes in this revision

Viewing changes to src/gldit/cairo-dock-keybinder.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthieu Baerts (matttbe)
  • Date: 2011-03-17 14:08:48 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20110317140848-b8efysl4ynhjm87k
Tags: 2.3.0~1-0ubuntu1
* New Upstream Version (LP: #723994)
* Upstream short ChangeLog:
 - Updated translations
 - Updated the integration of the new versions of kwin and compiz
 - Updated default theme
 - Fixed a few bugs
 - Updated the man
* debian/control:
 - Added suggests apps for cairo-dock-core (needed by the default theme)
 - Updated the description (from launchpad.net/cairo-dock)
 - Added cairo-dock-plug-ins as a new suggestion for cairo-dock-core
* debian/patches:
 - Updated the default theme to use default apps of Ubuntu Natty 
* Switch to dpkg-source 3.0 (quilt) format
* Removed the desktop-file-category patch (sync with debian packages)
* debian/rules:
 - Added a CMake flag to disable the gtk grip
 - No longer used simple-patchsys
* Updated the debian/watch

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
#include <gdk/gdkwindow.h>
34
34
#include <gdk/gdkx.h>
35
35
#include <X11/Xlib.h>
36
 
#include "../config.h"
 
36
#include "gldi-config.h"
37
37
#ifdef HAVE_XEXTEND
38
38
#include <X11/extensions/XTest.h>
39
39
#endif
41
41
#include "eggaccelerators.h"
42
42
#include "cairo-dock-log.h"
43
43
#include "cairo-dock-X-utilities.h"
 
44
#include "cairo-dock-notifications.h"
44
45
#include "cairo-dock-keybinder.h"
45
46
 
46
47
typedef unsigned int uint;
52
53
        uint                  modifiers;
53
54
} Binding;
54
55
 
 
56
// public (manager, config, data)
 
57
CairoShortcutsManager myShortcutsMgr;
 
58
 
 
59
// dependancies
 
60
 
 
61
// private
55
62
static GSList *bindings = NULL;
56
 
static guint32 last_event_time = 0;
57
 
static gboolean processing_event = FALSE;
 
63
///static guint32 last_event_time = 0;
 
64
///static gboolean processing_event = FALSE;
58
65
 
59
66
static guint num_lock_mask=0, caps_lock_mask=0, scroll_lock_mask=0;
60
67
 
191
198
                 * Set the last event time for use when showing
192
199
                 * windows to avoid anti-focus-stealing code.
193
200
                 */
194
 
                processing_event = TRUE;
195
 
                last_event_time = xevent->xkey.time;
 
201
                ///processing_event = TRUE;
 
202
                ///last_event_time = xevent->xkey.time;
196
203
 
197
204
                event_mods = xevent->xkey.state & ~(num_lock_mask  |
198
205
                                                    caps_lock_mask |
212
219
                        }
213
220
                }
214
221
 
215
 
                processing_event = FALSE;
 
222
                ///processing_event = FALSE;
216
223
                break;
217
224
        case KeyRelease:
218
225
                cd_debug ("Got KeyRelease! ");
316
323
        cd_debug ("%s (%s)", __func__, keystring);
317
324
        GSList *iter;
318
325
 
319
 
        if (!keystring)
320
 
          return;
 
326
        if (!keystring)
 
327
                return;
321
328
        for (iter = bindings; iter != NULL; iter = iter->next) {
322
329
                Binding *binding = (Binding *) iter->data;
323
330
 
365
372
        return retval;
366
373
}
367
374
 
368
 
guint32
 
375
/**guint32
369
376
cd_keybinder_get_current_event_time (void)
370
377
{
371
378
        if (processing_event)
372
379
                return last_event_time;
373
380
        else
374
381
                return GDK_CURRENT_TIME;
375
 
}
 
382
}*/
376
383
 
377
384
 
378
385
gboolean cairo_dock_simulate_key_sequence (gchar *cKeyString)  // the idea was taken from xdo.
410
417
}
411
418
 
412
419
 
 
420
 
 
421
  ////////////
 
422
 /// INIT ///
 
423
////////////
 
424
 
 
425
static void init (void)
 
426
{
 
427
        cd_keybinder_init ();
 
428
}
 
429
 
 
430
 
 
431
static void unload (void)
 
432
{
 
433
        GSList *iter;
 
434
        for (iter = bindings; iter != NULL; iter = iter->next)  // normalement la liste devrait etre vide.
 
435
        {
 
436
                Binding *binding = (Binding *) iter->data;
 
437
                
 
438
                cd_debug (" --- remove key binding '%s'\n", binding->keystring);
 
439
                do_ungrab_key (binding);
 
440
                
 
441
                g_free (binding->keystring);
 
442
                g_free (binding);
 
443
        }
 
444
        g_slist_free (bindings);
 
445
        bindings = NULL;
 
446
}
 
447
 
 
448
  ///////////////
 
449
 /// MANAGER ///
 
450
///////////////
 
451
 
 
452
void gldi_register_shortcuts_manager (void)
 
453
{
 
454
        // Manager
 
455
        memset (&myShortcutsMgr, 0, sizeof (CairoShortcutsManager));
 
456
        myShortcutsMgr.mgr.cModuleName  = "Shortcuts";
 
457
        myShortcutsMgr.mgr.init                 = init;
 
458
        myShortcutsMgr.mgr.load                 = NULL;
 
459
        myShortcutsMgr.mgr.unload               = unload;
 
460
        myShortcutsMgr.mgr.reload               = (GldiManagerReloadFunc)NULL;
 
461
        myShortcutsMgr.mgr.get_config   = (GldiManagerGetConfigFunc)NULL;
 
462
        myShortcutsMgr.mgr.reset_config = (GldiManagerResetConfigFunc)NULL;
 
463
        // Config
 
464
        myShortcutsMgr.mgr.pConfig = (GldiManagerConfigPtr*)NULL;
 
465
        myShortcutsMgr.mgr.iSizeOfConfig = 0;
 
466
        // data
 
467
        myShortcutsMgr.mgr.pData = (GldiManagerDataPtr*)NULL;
 
468
        myShortcutsMgr.mgr.iSizeOfData = 0;
 
469
        // signals
 
470
        cairo_dock_install_notifications_on_object (&myShortcutsMgr, NB_NOTIFICATIONS_SHORTCUTS);
 
471
        // register
 
472
        gldi_register_manager (GLDI_MANAGER(&myShortcutsMgr));
 
473
}
 
474