Subject: xzgv: panning with the mouse does not work
Date: Thu, 14 Aug 2008 22:42:28 +0800
Package: xzgv
Version: 0.9+svn40-1
Severity: normal
A useful feature that vanished between 0.8 and 0.9.
-- System Information:
Debian Release: lenny/sid
APT prefers testing
APT policy: (499, 'testing'), (496, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.25-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_AU, LC_CTYPE=en_AU (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash
Versions of packages xzgv depends on:
ii libc6 2.7-13 GNU C Library: Shared libraries
ii libglib2.0-0 2.16.4-2 The GLib library of C routines
ii libgtk2.0-0 2.12.11-3 The GTK+ graphical user interface
ii libx11-6 2:1.1.4-2 X11 client-side library
xzgv recommends no packages.
xzgv suggests no packages.
-- no debconf information
-MD
--
-------------------------------------------------------------------------------
Michael Deegan Hugaholic http://wibble.darktech.org/gallery/
------------------------- Nyy Tybel Gb Gur Ulcabgbnq! -------------------------
Acknowledgement sent
to Kevin Ryde <[email protected]>:
Extra info received and forwarded to list. Copy sent to Theodore Y. Ts'o <[email protected]>.
(Sun, 02 Sep 2012 01:45:03 GMT) (full text, mbox, link).
Michael Deegan <[email protected]> writes:
>
> A useful feature that vanished between 0.8 and 0.9.
The code seems to be slightly fighting gtk in the pointer motion bits.
I'd propose something like below which takes button press, motion,
release on the "viewport" widget, not the scrolledwindow or mainwin etc.
Normally it works much better to choose where a click should be active
and select,connect,etc in one place only.
This diff is a bit radical in how much it chops out :), but it's
supposed to be a simplification. I hope I haven't broken anything else
in the process. Better give it a try for a while.
It might be necessary to turn on the "ignore_drag" flag in the
shift-button or control-button press cases, so that dragging is not
active in those cases. Unless it's in fact desirable to have dragging
work if initiated by one of those too.
--- main.c.orig 2009-02-23 08:17:57.000000000 +1100
+++ main.c 2012-09-02 11:21:57.000000000 +1000
@@ -96,7 +96,7 @@
#define RECURSE_PROTECT_END here=0
-GtkWidget *drawing_area,*align,*sw_for_pic;
+GtkWidget *drawing_area,*align,*viewport,*sw_for_pic;
GtkWidget *clist,*statusbar,*sw_for_clist;
GtkWidget *selector_menu,*viewer_menu;
GtkWidget *zoom_widget; /* widget for zoom opt on menu */
@@ -763,30 +763,6 @@
}
-/* button press on one of the image's scrollbars. Needed to override
- * the above, as bringing up the menu by right-clicking on a scrollbar
- * causes all mouse stuff to hang for some reason...!
- */
-gint viewer_sb_button_press(GtkWidget *widget,GdkEventButton *event)
-{
-/* doesn't have to do anything */
-return(TRUE);
-}
-
-
-gint clist_sw_ebox_button_press(GtkWidget *widget,GdkEventButton *event)
-{
-if(event->button==1)
- {
- /* this is a drag on the selector, so make sure image-dragging ignores it! */
- ignore_drag=1;
- next_on_release=0; /* don't try to move to next image */
- }
-
-return(FALSE);
-}
-
-
void move_pic(float xadd,float yadd)
{
GtkAdjustment *hadj,*vadj;
@@ -3712,17 +3688,9 @@
viewer_menu_items[0]));
viewer_menu=gtk_item_factory_get_widget(viewer_menu_factory,"<main>");
-gtk_signal_connect(GTK_OBJECT(drawing_area),"motion_notify_event",
- GTK_SIGNAL_FUNC(viewer_motion),NULL);
gtk_signal_connect(GTK_OBJECT(drawing_area),"key_press_event",
GTK_SIGNAL_FUNC(viewer_key_press),NULL);
-
-/* need to ask for motion while button 1 is pressed (for drag),
- * keypresses, and (for scaling) expose.
- */
-gtk_widget_set_events(drawing_area,
- GDK_BUTTON1_MOTION_MASK|GDK_KEY_PRESS_MASK|
- GDK_EXPOSURE_MASK);
+gtk_widget_set_events(drawing_area,GDK_KEY_PRESS_MASK|GDK_EXPOSURE_MASK);
gtk_widget_show(drawing_area);
@@ -3744,6 +3712,19 @@
align);
gtk_widget_show(sw_for_pic);
+/* Button-press and button-motion on the viewport widget so that dragging
+ and menu popup works in non-image parts too. Dragging the non-image part
+ is good if drawing_area is very thin. */
+viewport = gtk_widget_get_parent(align);
+gtk_widget_add_events(viewport,
+ GDK_BUTTON_PRESS_MASK|GDK_BUTTON1_MOTION_MASK|
+ GDK_BUTTON_RELEASE_MASK);
+gtk_signal_connect(GTK_OBJECT(viewport),"button_press_event",
+ GTK_SIGNAL_FUNC(viewer_button_press),NULL);
+gtk_signal_connect(GTK_OBJECT(viewport),"motion_notify_event",
+ GTK_SIGNAL_FUNC(viewer_motion),NULL);
+gtk_signal_connect(GTK_OBJECT(viewport),"button_release_event",
+ GTK_SIGNAL_FUNC(viewer_button_release),NULL);
/* left-hand side */
vboxl=gtk_vbox_new(FALSE,0);
@@ -3759,19 +3740,6 @@
*/
clist_sw_ebox=gtk_event_box_new();
gtk_box_pack_start(GTK_BOX(vboxl),clist_sw_ebox,TRUE,TRUE,0);
-
-/* pass on left-button motion events to viewer's image-dragging stuff,
- * so it doesn't stop dragging just because you drag the pointer over
- * the selector. This means we have to carefully ignore any drags which
- * start in the selector though, hence the left-button-press event
- * handling here.
- */
-gtk_signal_connect(GTK_OBJECT(clist_sw_ebox),"button_press_event",
- GTK_SIGNAL_FUNC(clist_sw_ebox_button_press),NULL);
-gtk_signal_connect(GTK_OBJECT(clist_sw_ebox),"motion_notify_event",
- GTK_SIGNAL_FUNC(viewer_motion),NULL);
-gtk_widget_set_events(clist_sw_ebox,
- GDK_BUTTON_PRESS_MASK|GDK_BUTTON1_MOTION_MASK);
gtk_widget_show(clist_sw_ebox);
/* now the scrolled window for clist, and the clist which goes into it. */
@@ -3980,35 +3948,9 @@
GDK_q,0,0);
-/* severely hairy, but needed to allow menu to appear when a non-image
- * bit of the viewer window is selected. Also allows drags in non-image
- * bits, which is handy for really thin images.
- */
-gtk_signal_connect(GTK_OBJECT(sw_for_pic),
- "button_press_event",
- GTK_SIGNAL_FUNC(viewer_button_press),NULL);
-
-/* have to carefully override this for scrollbars! */
-gtk_signal_connect_after(
- GTK_OBJECT(GTK_SCROLLED_WINDOW(sw_for_pic)->hscrollbar),
- "button_press_event",GTK_SIGNAL_FUNC(viewer_sb_button_press),NULL);
-gtk_signal_connect_after(
- GTK_OBJECT(GTK_SCROLLED_WINDOW(sw_for_pic)->vscrollbar),
- "button_press_event",GTK_SIGNAL_FUNC(viewer_sb_button_press),NULL);
-
-
gtk_signal_connect(GTK_OBJECT(mainwin),"configure_event",
GTK_SIGNAL_FUNC(pic_win_resized),NULL);
-/* this catches dragging across the pane splitter */
-gtk_signal_connect(GTK_OBJECT(mainwin),"motion_notify_event",
- GTK_SIGNAL_FUNC(viewer_motion),NULL);
-gtk_signal_connect(GTK_OBJECT(mainwin),
- "button_release_event",
- GTK_SIGNAL_FUNC(viewer_button_release),NULL);
-/* ask for configure and left-button drag */
-gtk_widget_set_events(mainwin,
- GDK_STRUCTURE_MASK|GDK_BUTTON1_MOTION_MASK|
- GDK_BUTTON_RELEASE_MASK);
+gtk_widget_set_events(mainwin,GDK_STRUCTURE_MASK);
/* if hidden is set, we should hide it initially */
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.