diff options
-rw-r--r-- | src/applet-main.c | 28 | ||||
-rw-r--r-- | src/eggaccelerators.c | 70 | ||||
-rw-r--r-- | src/tomboykeybinder.c | 76 |
3 files changed, 87 insertions, 87 deletions
diff --git a/src/applet-main.c b/src/applet-main.c index f1792b8..30449a8 100644 --- a/src/applet-main.c +++ b/src/applet-main.c @@ -97,7 +97,7 @@ MATE_PANEL_APPLET_OUT_PROCESS_FACTORY ("IndicatorAppletAppmenuFactory", GOutputStream * log_file = NULL; /***************** - * Hotkey support + * Hotkey support * **************/ #ifdef INDICATOR_APPLET gchar * hotkey_keycode = "<Super>M"; @@ -314,12 +314,12 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, GtkWidget * men break; case GTK_PACK_DIRECTION_TTB: gtk_label_set_angle(GTK_LABEL(entry->label), - (orient == MATE_PANEL_APPLET_ORIENT_LEFT) ? + (orient == MATE_PANEL_APPLET_ORIENT_LEFT) ? 270.0 : 90.0); break; default: break; - } + } gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(entry->label), FALSE, FALSE, 1); if (gtk_widget_get_visible(GTK_WIDGET(entry->label))) { @@ -671,12 +671,12 @@ swap_orient_cb (GtkWidget *item, gpointer data) break; case GTK_PACK_DIRECTION_TTB: gtk_label_set_angle(GTK_LABEL(item), - (orient == MATE_PANEL_APPLET_ORIENT_LEFT) ? + (orient == MATE_PANEL_APPLET_ORIENT_LEFT) ? 270.0 : 90.0); break; default: break; - } + } } gtk_box_pack_start(GTK_BOX(to), item, FALSE, FALSE, 0); return TRUE; @@ -703,12 +703,12 @@ matepanelapplet_reorient_cb (GtkWidget *applet, MatePanelAppletOrient neworient, gpointer data) { GtkWidget *menubar = (GtkWidget *)data; - if ((((neworient == MATE_PANEL_APPLET_ORIENT_UP) || - (neworient == MATE_PANEL_APPLET_ORIENT_DOWN)) && - ((orient == MATE_PANEL_APPLET_ORIENT_LEFT) || - (orient == MATE_PANEL_APPLET_ORIENT_RIGHT))) || - (((neworient == MATE_PANEL_APPLET_ORIENT_LEFT) || - (neworient == MATE_PANEL_APPLET_ORIENT_RIGHT)) && + if ((((neworient == MATE_PANEL_APPLET_ORIENT_UP) || + (neworient == MATE_PANEL_APPLET_ORIENT_DOWN)) && + ((orient == MATE_PANEL_APPLET_ORIENT_LEFT) || + (orient == MATE_PANEL_APPLET_ORIENT_RIGHT))) || + (((neworient == MATE_PANEL_APPLET_ORIENT_LEFT) || + (neworient == MATE_PANEL_APPLET_ORIENT_RIGHT)) && ((orient == MATE_PANEL_APPLET_ORIENT_UP) || (orient == MATE_PANEL_APPLET_ORIENT_DOWN)))) { packdirection = (packdirection == GTK_PACK_DIRECTION_LTR) ? @@ -810,7 +810,7 @@ applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED, #ifdef INDICATOR_APPLET_APPMENU g_set_application_name(_("Indicator Applet Application Menu")); #endif - + g_log_set_default_handler(log_to_file, NULL); tomboy_keybinder_init(); @@ -875,7 +875,7 @@ applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED, /* Build menubar */ orient = (mate_panel_applet_get_orient(applet)); packdirection = ((orient == MATE_PANEL_APPLET_ORIENT_UP) || - (orient == MATE_PANEL_APPLET_ORIENT_DOWN)) ? + (orient == MATE_PANEL_APPLET_ORIENT_DOWN)) ? GTK_PACK_DIRECTION_LTR : GTK_PACK_DIRECTION_TTB; gtk_menu_bar_set_pack_direction(GTK_MENU_BAR(menubar), packdirection); @@ -887,7 +887,7 @@ applet_fill_cb (MatePanelApplet * applet, const gchar * iid G_GNUC_UNUSED, #else g_signal_connect_after(menubar, "expose-event", G_CALLBACK(menubar_on_expose), menubar); #endif - g_signal_connect(applet, "change-orient", + g_signal_connect(applet, "change-orient", G_CALLBACK(matepanelapplet_reorient_cb), menubar); gtk_container_set_border_width(GTK_CONTAINER(menubar), 0); diff --git a/src/eggaccelerators.c b/src/eggaccelerators.c index 3038ce9..63329a3 100644 --- a/src/eggaccelerators.c +++ b/src/eggaccelerators.c @@ -14,7 +14,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ #include "eggaccelerators.h" @@ -196,7 +196,7 @@ is_hyper (const gchar *string) * can represent various keyboard keys (numlock, meta, hyper, etc.), * the virtual modifier represents the keyboard key, the concrete * modifier the actual Mod2-Mod5 bits in the key press event. - * + * * Returns: %TRUE on success. */ gboolean @@ -208,7 +208,7 @@ egg_accelerator_parse_virtual (const gchar *accelerator, GdkModifierType mods; gint len; gboolean bad_keyval; - + if (accelerator_key) *accelerator_key = 0; if (accelerator_mods) @@ -217,7 +217,7 @@ egg_accelerator_parse_virtual (const gchar *accelerator, g_return_val_if_fail (accelerator != NULL, FALSE); bad_keyval = FALSE; - + keyval = 0; mods = 0; len = strlen (accelerator); @@ -300,7 +300,7 @@ egg_accelerator_parse_virtual (const gchar *accelerator, else { gchar last_ch; - + last_ch = *accelerator; while (last_ch && last_ch != '>') { @@ -313,15 +313,15 @@ egg_accelerator_parse_virtual (const gchar *accelerator, else { keyval = gdk_keyval_from_name (accelerator); - + if (keyval == 0) bad_keyval = TRUE; - + accelerator += len; - len -= len; + len -= len; } } - + if (accelerator_key) *accelerator_key = gdk_keyval_to_lower (keyval); if (accelerator_mods) @@ -336,7 +336,7 @@ egg_accelerator_parse_virtual (const gchar *accelerator, * @accelerator_key: accelerator keyval * @accelerator_mods: accelerator modifier mask * @returns: a newly-allocated accelerator name - * + * * Converts an accelerator keyval and modifier mask * into a string parseable by egg_accelerator_parse_virtual(). * For example, if you pass in #GDK_q and #EGG_VIRTUAL_CONTROL_MASK, @@ -453,7 +453,7 @@ egg_virtual_accelerator_name (guint accelerator_key, strcpy (accelerator + l, text_super); l += sizeof (text_super) - 1; } - + strcpy (accelerator + l, keyval_name); return accelerator; @@ -470,11 +470,11 @@ egg_keymap_resolve_virtual_modifiers (GdkKeymap *keymap, g_return_if_fail (GDK_IS_KEYMAP (keymap)); g_return_if_fail (concrete_mods != NULL); - + modmap = egg_keymap_get_modmap (keymap); - + /* Not so sure about this algorithm. */ - + concrete = 0; i = 0; while (i < EGG_MODMAP_ENTRY_LAST) @@ -496,14 +496,14 @@ egg_keymap_virtualize_modifiers (GdkKeymap *keymap, GdkModifierType virtual; int i; const EggModmap *modmap; - + g_return_if_fail (GDK_IS_KEYMAP (keymap)); g_return_if_fail (virtual_mods != NULL); modmap = egg_keymap_get_modmap (keymap); - + /* Not so sure about this algorithm. */ - + virtual = 0; i = 0; while (i < EGG_MODMAP_ENTRY_LAST) @@ -511,12 +511,12 @@ egg_keymap_virtualize_modifiers (GdkKeymap *keymap, if ((1 << i) & concrete_mods) { EggVirtualModifierType cleaned; - + cleaned = modmap->mapping[i] & ~(EGG_VIRTUAL_MOD2_MASK | EGG_VIRTUAL_MOD3_MASK | EGG_VIRTUAL_MOD4_MASK | EGG_VIRTUAL_MOD5_MASK); - + if (cleaned != 0) { virtual |= cleaned; @@ -529,10 +529,10 @@ egg_keymap_virtualize_modifiers (GdkKeymap *keymap, virtual |= modmap->mapping[i]; } } - + ++i; } - + *virtual_mods = virtual; } @@ -548,7 +548,7 @@ reload_modmap (GdkKeymap *keymap, xmodmap = XGetModifierMapping (gdk_x11_get_default_xdisplay ()); memset (modmap->mapping, 0, sizeof (modmap->mapping)); - + /* there are 8 modifiers, and the first 3 are shift, shift lock, * and control */ @@ -565,7 +565,7 @@ reload_modmap (GdkKeymap *keymap, int n_entries; int j; EggVirtualModifierType mask; - + keys = NULL; keyvals = NULL; n_entries = 0; @@ -573,11 +573,11 @@ reload_modmap (GdkKeymap *keymap, gdk_keymap_get_entries_for_keycode (keymap, keycode, &keys, &keyvals, &n_entries); - + mask = 0; j = 0; while (j < n_entries) - { + { if (keyvals[j] == GDK_KEY_Num_Lock) mask |= EGG_VIRTUAL_NUM_LOCK_MASK; else if (keyvals[j] == GDK_KEY_Scroll_Lock) @@ -593,19 +593,19 @@ reload_modmap (GdkKeymap *keymap, mask |= EGG_VIRTUAL_SUPER_MASK; else if (keyvals[j] == GDK_KEY_Mode_switch) mask |= EGG_VIRTUAL_MODE_SWITCH_MASK; - + ++j; } /* Mod1Mask is 1 << 3 for example, i.e. the * fourth modifier, i / keyspermod is the modifier * index - */ + */ modmap->mapping[i/xmodmap->max_keypermod] |= mask; - + g_free (keyvals); - g_free (keys); - + g_free (keys); + ++i; } @@ -618,7 +618,7 @@ reload_modmap (GdkKeymap *keymap, modmap->mapping[EGG_MODMAP_ENTRY_MOD3] |= EGG_VIRTUAL_MOD3_MASK; modmap->mapping[EGG_MODMAP_ENTRY_MOD4] |= EGG_VIRTUAL_MOD4_MASK; modmap->mapping[EGG_MODMAP_ENTRY_MOD5] |= EGG_VIRTUAL_MOD5_MASK; - + XFreeModifiermap (xmodmap); } @@ -630,7 +630,7 @@ egg_keymap_get_modmap (GdkKeymap *keymap) /* This is all a hack, much simpler when we can just * modify GDK directly. */ - + modmap = g_object_get_data (G_OBJECT (keymap), "egg-modmap"); @@ -641,9 +641,9 @@ egg_keymap_get_modmap (GdkKeymap *keymap) /* FIXME modify keymap change events with an event filter * and force a reload if we get one */ - + reload_modmap (keymap, modmap); - + g_object_set_data_full (G_OBJECT (keymap), "egg-modmap", modmap, @@ -651,6 +651,6 @@ egg_keymap_get_modmap (GdkKeymap *keymap) } g_assert (modmap != NULL); - + return modmap; } diff --git a/src/tomboykeybinder.c b/src/tomboykeybinder.c index 29a8e27..870d536 100644 --- a/src/tomboykeybinder.c +++ b/src/tomboykeybinder.c @@ -13,7 +13,7 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA */ #include <string.h> @@ -51,21 +51,21 @@ static guint num_lock_mask, caps_lock_mask, scroll_lock_mask; static void lookup_ignorable_modifiers (GdkKeymap *keymap) { - egg_keymap_resolve_virtual_modifiers (keymap, + egg_keymap_resolve_virtual_modifiers (keymap, EGG_VIRTUAL_LOCK_MASK, &caps_lock_mask); - egg_keymap_resolve_virtual_modifiers (keymap, + egg_keymap_resolve_virtual_modifiers (keymap, EGG_VIRTUAL_NUM_LOCK_MASK, &num_lock_mask); - egg_keymap_resolve_virtual_modifiers (keymap, + egg_keymap_resolve_virtual_modifiers (keymap, EGG_VIRTUAL_SCROLL_LOCK_MASK, &scroll_lock_mask); } static void -grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin, +grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin, Binding *binding, gboolean grab) { @@ -83,23 +83,23 @@ grab_ungrab_with_ignorable_modifiers (GdkWindow *rootwin, for (i = 0; i < G_N_ELEMENTS (mod_masks); i++) { if (grab) { - XGrabKey (GDK_WINDOW_XDISPLAY (rootwin), - binding->keycode, - binding->modifiers | mod_masks [i], - GDK_WINDOW_XID (rootwin), - False, + XGrabKey (GDK_WINDOW_XDISPLAY (rootwin), + binding->keycode, + binding->modifiers | mod_masks [i], + GDK_WINDOW_XID (rootwin), + False, GrabModeAsync, GrabModeAsync); } else { XUngrabKey (GDK_WINDOW_XDISPLAY (rootwin), binding->keycode, - binding->modifiers | mod_masks [i], + binding->modifiers | mod_masks [i], GDK_WINDOW_XID (rootwin)); } } } -static gboolean +static gboolean do_grab_key (Binding *binding) { GdkKeymap *keymap = gdk_keymap_get_default (); @@ -111,14 +111,14 @@ do_grab_key (Binding *binding) if (keymap == NULL || rootwin == NULL) return FALSE; - if (!egg_accelerator_parse_virtual (binding->keystring, - &keysym, + if (!egg_accelerator_parse_virtual (binding->keystring, + &keysym, &virtual_mods)) return FALSE; TRACE (g_print ("Got accel %d, %d\n", keysym, virtual_mods)); - binding->keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (rootwin), + binding->keycode = XKeysymToKeycode (GDK_WINDOW_XDISPLAY (rootwin), keysym); if (binding->keycode == 0) return FALSE; @@ -135,8 +135,8 @@ do_grab_key (Binding *binding) gdk_error_trap_push (); - grab_ungrab_with_ignorable_modifiers (rootwin, - binding, + grab_ungrab_with_ignorable_modifiers (rootwin, + binding, TRUE /* grab */); gdk_flush (); @@ -149,15 +149,15 @@ do_grab_key (Binding *binding) return TRUE; } -static gboolean +static gboolean do_ungrab_key (Binding *binding) { GdkWindow *rootwin = gdk_get_default_root_window (); TRACE (g_print ("Removing grab for '%s'\n", binding->keystring)); - grab_ungrab_with_ignorable_modifiers (rootwin, - binding, + grab_ungrab_with_ignorable_modifiers (rootwin, + binding, FALSE /* ungrab */); return TRUE; @@ -176,31 +176,31 @@ filter_func (GdkXEvent *gdk_xevent, GdkEvent *event G_GNUC_UNUSED, switch (xevent->type) { case KeyPress: - TRACE (g_print ("Got KeyPress! keycode: %d, modifiers: %d\n", - xevent->xkey.keycode, + TRACE (g_print ("Got KeyPress! keycode: %d, modifiers: %d\n", + xevent->xkey.keycode, xevent->xkey.state)); - /* + /* * Set the last event time for use when showing * windows to avoid anti-focus-stealing code. */ processing_event = TRUE; last_event_time = xevent->xkey.time; - event_mods = xevent->xkey.state & ~(num_lock_mask | - caps_lock_mask | + event_mods = xevent->xkey.state & ~(num_lock_mask | + caps_lock_mask | scroll_lock_mask); for (iter = bindings; iter != NULL; iter = iter->next) { Binding *binding = (Binding *) iter->data; - + if (binding->keycode == xevent->xkey.keycode && binding->modifiers == event_mods) { - TRACE (g_print ("Calling handler for '%s'...\n", + TRACE (g_print ("Calling handler for '%s'...\n", binding->keystring)); - (binding->handler) (binding->keystring, + (binding->handler) (binding->keystring, binding->user_data); } } @@ -215,7 +215,7 @@ filter_func (GdkXEvent *gdk_xevent, GdkEvent *event G_GNUC_UNUSED, return return_val; } -static void +static void keymap_changed (GdkKeymap *map G_GNUC_UNUSED) { GdkKeymap *keymap = gdk_keymap_get_default (); @@ -236,7 +236,7 @@ keymap_changed (GdkKeymap *map G_GNUC_UNUSED) } } -void +void tomboy_keybinder_init (void) { GdkKeymap *keymap = gdk_keymap_get_default (); @@ -244,17 +244,17 @@ tomboy_keybinder_init (void) lookup_ignorable_modifiers (keymap); - gdk_window_add_filter (rootwin, - filter_func, + gdk_window_add_filter (rootwin, + filter_func, NULL); - g_signal_connect (keymap, + g_signal_connect (keymap, "keys_changed", G_CALLBACK (keymap_changed), NULL); } -void +void tomboy_keybinder_bind (const char *keystring, TomboyBindkeyHandler handler, gpointer user_data) @@ -279,7 +279,7 @@ tomboy_keybinder_bind (const char *keystring, } void -tomboy_keybinder_unbind (const char *keystring, +tomboy_keybinder_unbind (const char *keystring, TomboyBindkeyHandler handler) { GSList *iter; @@ -288,7 +288,7 @@ tomboy_keybinder_unbind (const char *keystring, Binding *binding = (Binding *) iter->data; if (strcmp (keystring, binding->keystring) != 0 || - handler != binding->handler) + handler != binding->handler) continue; do_ungrab_key (binding); @@ -301,7 +301,7 @@ tomboy_keybinder_unbind (const char *keystring, } } -/* +/* * From eggcellrenderkeys.c. */ gboolean @@ -333,7 +333,7 @@ tomboy_keybinder_is_modifier (guint keycode) guint32 tomboy_keybinder_get_current_event_time (void) { - if (processing_event) + if (processing_event) return last_event_time; else return GDK_CURRENT_TIME; |