~ubuntu-branches/ubuntu/edgy/xfce-mcs-plugins/edgy

« back to all changes in this revision

Viewing changes to plugins/shortcuts_plugin/shortcuts_plugin.c

  • Committer: Bazaar Package Importer
  • Author(s): Jani Monoses
  • Date: 2006-02-21 12:44:00 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20060221124400-njwotsoltds9b6ga
Tags: 4.3.0svn+r19979-0ubuntu1
Upstream svn snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright (c) 2005 Jean-François Wauthy <pollux@xfce.org>
 
1
/*      $Id: shortcuts_plugin.c 19936 2006-02-18 08:52:32Z olivier $
 
2
 *
 
3
 * Copyright (c) 2006 Jean-Francois Wauthy <pollux@xfce.org>
3
4
 *                    Olivier Fourdan <fourdan@xfce.org>
4
5
 *
5
6
 * This program is free software; you can redistribute it and/or modify
120
121
 
121
122
/* globals */
122
123
static gboolean is_running = FALSE;
 
124
static gboolean wait_release = FALSE;
123
125
static GSList *shortcut_list = NULL;
124
126
static gchar *theme_name = NULL;
125
127
static gchar *theme_path = NULL;
135
137
/****************************/
136
138
 
137
139
static void
138
 
handleKeyRelease (XKeyReleasedEvent * ev)
 
140
handleKeyPress (XKeyPressedEvent * ev)
139
141
{
140
142
    GSList *element;
141
143
    int state;
142
144
 
143
145
    state = ev->state & MODIFIER_MASK;
144
146
 
 
147
    if (wait_release)
 
148
    {
 
149
        return;
 
150
    }
 
151
 
145
152
    for (element = shortcut_list; element != NULL; element = g_slist_next (element))
146
153
    {
147
154
        launcher *shortcut = (launcher *) element->data;
152
159
            GdkScreen *gscr;
153
160
            gint monitor;
154
161
            
 
162
            /* We must wait for a release event before te trigger another key press */
 
163
            wait_release = TRUE;
155
164
            gdisplay = gdk_display_get_default ();
156
165
            gscr = xfce_gdk_display_locate_monitor_with_pointer (gdisplay, &monitor);
157
166
            
169
178
}
170
179
 
171
180
static void
 
181
handleKeyRelease (XKeyReleasedEvent * ev)
 
182
{
 
183
    wait_release = FALSE;
 
184
}
 
185
 
 
186
static void
172
187
handleMappingNotify (XMappingEvent * ev)
173
188
{
174
189
    GSList *element;
175
190
 
 
191
    /* Clear up the flag as the keyboard mapping changes, we may never receive the release event */
 
192
    wait_release = FALSE;
 
193
 
176
194
    /* Refreshes the stored modifier and keymap information */
177
195
    XRefreshKeyboardMapping (ev);
178
196
 
200
218
    switch (ev->type)
201
219
    {
202
220
        case KeyPress:
 
221
            handleKeyPress ((XKeyPressedEvent *) ev);
203
222
            break;
204
223
        case KeyRelease:
205
224
            handleKeyRelease ((XKeyReleasedEvent *) ev);