Author: post
Date: 2011-02-19 13:09:40 +0100 (Sat, 19 Feb 2011)
New Revision: 3817

Modified:
   trunk/src/gtk-helper.c
   trunk/src/gtk-helper.h
   trunk/src/gtk-interface.c
Log:
Block keyboard events while deleting photos.

Modified: trunk/src/gtk-helper.c
===================================================================
--- trunk/src/gtk-helper.c      2011-02-19 11:28:13 UTC (rev 3816)
+++ trunk/src/gtk-helper.c      2011-02-19 12:09:40 UTC (rev 3817)
@@ -48,6 +48,8 @@
 static inline guint8 convert_color_channel (guint8 src, guint8 alpha);
 static gboolean label_new_with_mouseover_cb(GtkWidget *widget, 
GdkEventCrossing *event, gpointer user_data);
 
+static gboolean rs_block_keyboard = FALSE;
+
 enum {
        COMBO_CONF_ID = 0,
        COMBO_TEXT,
@@ -303,6 +305,11 @@
        return;
 }
 
+void gui_set_block_keyboard(gboolean block_keyboard)
+{
+       rs_block_keyboard = block_keyboard;
+}
+
 /* copied verbatim from Gimp: app/widgets/gimpdock.c */
 gboolean
 window_key_press_event (GtkWidget   *widget,
@@ -317,12 +324,16 @@
    * before the accelerator activation scheme.
    */
 
-  /* control/alt accelerators get all key events first */
+  /* Eat the event, if we are told so */
   if (! handled && event->state & (GDK_CONTROL_MASK | GDK_MOD1_MASK))
     handled = gtk_window_activate_key (window, event);
 
+  /* control/alt accelerators get all key events first */
+  if (! handled && rs_block_keyboard)
+    handled = TRUE;
+
   /* invoke text widgets  */
-  if (G_UNLIKELY (GTK_IS_EDITABLE (focus) || GTK_IS_TEXT_VIEW (focus)))
+  if (! handled && G_UNLIKELY (GTK_IS_EDITABLE (focus) || GTK_IS_TEXT_VIEW 
(focus)))
     handled = gtk_window_propagate_key_event (window, event);
 
   /* invoke focus widget handlers */

Modified: trunk/src/gtk-helper.h
===================================================================
--- trunk/src/gtk-helper.h      2011-02-19 11:28:13 UTC (rev 3816)
+++ trunk/src/gtk-helper.h      2011-02-19 12:09:40 UTC (rev 3817)
@@ -49,6 +49,7 @@
 extern GtkWidget *gui_framed(GtkWidget *widget, const gchar *title, 
GtkShadowType shadowtype);
 extern GtkWidget *gui_aligned(GtkWidget *widget, const gfloat xalign, const 
gfloat yalign, const gfloat xscale, const gfloat yscale);
 extern GdkPixbuf *cairo_convert_to_pixbuf (cairo_surface_t *surface);
+extern void gui_set_block_keyboard(gboolean block_keyboard);
 
 /**
  * Build and show a popup-menu

Modified: trunk/src/gtk-interface.c
===================================================================
--- trunk/src/gtk-interface.c   2011-02-19 11:28:13 UTC (rev 3816)
+++ trunk/src/gtk-interface.c   2011-02-19 12:09:40 UTC (rev 3817)
@@ -271,6 +271,7 @@
        return;
 }
 
+
 /**
  * Change priority on all selected and currently opened photos
  */
@@ -299,6 +300,7 @@
                /* Load next image if deleting */
                if (next_name)
                        next_name = rs_store_get_prevnext(rs->store, next_name, 
2);
+               gui_set_block_keyboard(TRUE);
        }
 
 /* Iterate throuh all selected thumbnails */
@@ -332,6 +334,8 @@
 
        g_string_free(gs, TRUE);
        gui_set_busy(FALSE);
+       GTK_CATCHUP();
+       gui_set_block_keyboard(FALSE);
 }
 
 void


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to