[virt-tools-list] [PATCH] Revert changes related to numpad accelerators

Fabiano Fidêncio fidencio at redhat.com
Tue Sep 23 13:08:17 UTC 2014


Due to a GTK+ limitation and bad testing from my side, I've pushed
two patches trying to add support to use Ctrl + {+, -, 0} from numpad
to control zoom-in, zoom-out and zoom-reset.
Unfortunately, with the first patch (3a168815) I've duplicated the menu
items related to the zoom functions. With the second one (55cdb986),
provided to not show the duplicated menu items, we came back to the
initial state, where the numpad accelerators don't work.

So, in resume, multiple accelerators in a GTK+ widget are only supported
on applications using GApplication, what is not our case and won't be
till we drop the GTK+2 support.

Revert "Do not show duplicated menu items" and
Revert "Add support to use numpad accelarators for zoom-{in.out,reset}"

This reverts commits 55cdb9867df05f1c4f6c8e569a6f0c1e0bc28d99 and
3a168815b738076526ba0f3e9a82e6fb1db482e9.
---
 src/virt-gtk-compat.h |  3 ---
 src/virt-viewer-app.c |  6 ------
 src/virt-viewer.xml   | 36 ------------------------------------
 3 files changed, 45 deletions(-)

diff --git a/src/virt-gtk-compat.h b/src/virt-gtk-compat.h
index aca38b1..110c17a 100644
--- a/src/virt-gtk-compat.h
+++ b/src/virt-gtk-compat.h
@@ -57,9 +57,6 @@ G_BEGIN_DECLS
 #define GDK_0 GDK_KEY_0
 #define GDK_plus GDK_KEY_plus
 #define GDK_minus GDK_KEY_minus
-#define GDK_KP_Add GDK_KEY_KP_Add
-#define GDK_KP_Subtract GDK_KEY_KP_Subtract
-#define GDK_KP_0 GDK_KEY_KP_0
 #endif
 
 #if !GTK_CHECK_VERSION(3, 0, 0)
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 80ccc3b..a890bf6 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -1801,11 +1801,8 @@ virt_viewer_app_constructor (GType gtype,
     gtk_accel_map_add_entry("<virt-viewer>/view/toggle-fullscreen", GDK_F11, 0);
     gtk_accel_map_add_entry("<virt-viewer>/view/release-cursor", GDK_F12, GDK_SHIFT_MASK);
     gtk_accel_map_add_entry("<virt-viewer>/view/zoom-reset", GDK_0, GDK_CONTROL_MASK);
-    gtk_accel_map_add_entry("<virt-viewer>/view/kp-zoom-reset", GDK_KP_0, GDK_CONTROL_MASK);
     gtk_accel_map_add_entry("<virt-viewer>/view/zoom-out", GDK_minus, GDK_CONTROL_MASK);
-    gtk_accel_map_add_entry("<virt-viewer>/view/kp-zoom-out", GDK_KP_Subtract, GDK_CONTROL_MASK);
     gtk_accel_map_add_entry("<virt-viewer>/view/zoom-in", GDK_plus, GDK_CONTROL_MASK);
-    gtk_accel_map_add_entry("<virt-viewer>/view/kp-zoom-in", GDK_KP_Add, GDK_CONTROL_MASK);
     gtk_accel_map_add_entry("<virt-viewer>/send/secure-attention", GDK_End, GDK_CONTROL_MASK | GDK_MOD1_MASK);
 
     virt_viewer_app_set_fullscreen(self, opt_fullscreen);
@@ -1983,11 +1980,8 @@ virt_viewer_app_clear_hotkeys(VirtViewerApp *self)
     gtk_accel_map_change_entry("<virt-viewer>/view/toggle-fullscreen", 0, 0, TRUE);
     gtk_accel_map_change_entry("<virt-viewer>/view/release-cursor", 0, 0, TRUE);
     gtk_accel_map_change_entry("<virt-viewer>/view/zoom-reset", 0, 0, TRUE);
-    gtk_accel_map_change_entry("<virt-viewer>/view/kp-zoom-reset", 0, 0, TRUE);
     gtk_accel_map_change_entry("<virt-viewer>/view/zoom-in", 0, 0, TRUE);
-    gtk_accel_map_change_entry("<virt-viewer>/view/kp-zoom-in", 0, 0, TRUE);
     gtk_accel_map_change_entry("<virt-viewer>/view/zoom-out", 0, 0, TRUE);
-    gtk_accel_map_change_entry("<virt-viewer>/view/kp-zoom-out", 0, 0, TRUE);
     gtk_accel_map_change_entry("<virt-viewer>/send/secure-attention", 0, 0, TRUE);
     virt_viewer_set_insert_smartcard_accel(self, 0, 0);
     virt_viewer_set_remove_smartcard_accel(self, 0, 0);
diff --git a/src/virt-viewer.xml b/src/virt-viewer.xml
index 6f2eebb..d489653 100644
--- a/src/virt-viewer.xml
+++ b/src/virt-viewer.xml
@@ -138,18 +138,6 @@
                               </object>
                             </child>
                             <child>
-                              <object class="GtkImageMenuItem" id="menu-view-kp-zoom-in">
-                                <property name="accel_path"><virt-viewer>/view/kp-zoom-in</property>
-                                <property name="label">gtk-zoom-in</property>
-                                <property name="visible">False</property>
-                                <property name="can_focus">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="use_stock">True</property>
-                                <signal name="activate" handler="virt_viewer_window_menu_view_zoom_in" swapped="no"/>
-                              </object>
-                            </child>
-                            <child>
                               <object class="GtkImageMenuItem" id="menu-view-zoom-out">
                                 <property name="accel_path"><virt-viewer>/view/zoom-out</property>
                                 <property name="label">gtk-zoom-out</property>
@@ -162,18 +150,6 @@
                               </object>
                             </child>
                             <child>
-                              <object class="GtkImageMenuItem" id="menu-view-kp-zoom-out">
-                                <property name="accel_path"><virt-viewer>/view/kp-zoom-out</property>
-                                <property name="label">gtk-zoom-out</property>
-                                <property name="visible">False</property>
-                                <property name="can_focus">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="use_stock">True</property>
-                                <signal name="activate" handler="virt_viewer_window_menu_view_zoom_out" swapped="no"/>
-                              </object>
-                            </child>
-                            <child>
                               <object class="GtkSeparatorMenuItem" id="separatormenuitem4">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
@@ -191,18 +167,6 @@
                                 <signal name="activate" handler="virt_viewer_window_menu_view_zoom_reset" swapped="no"/>
                               </object>
                             </child>
-                            <child>
-                              <object class="GtkImageMenuItem" id="menu-view-kp-zoom-reset">
-                                <property name="accel_path"><virt-viewer>/view/kp-zoom-reset</property>
-                                <property name="label">gtk-zoom-100</property>
-                                <property name="visible">False</property>
-                                <property name="can_focus">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="use_underline">True</property>
-                                <property name="use_stock">True</property>
-                                <signal name="activate" handler="virt_viewer_window_menu_view_zoom_reset" swapped="no"/>
-                              </object>
-                            </child>
                           </object>
                         </child>
                       </object>
-- 
1.9.3




More information about the virt-tools-list mailing list