GNOME Bugzilla – Bug 601473
GDK_BUTTON?_MOTION_MASK appears to be broken
Last modified: 2010-01-12 18:08:19 UTC
copy of http://bugs.debian.org/555030 Package: libgtk2.0-0 Version: 2.18.3-1 Severity: important DVswitch has a custom widget which supports drag selection and extension, so its event mask is: GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK It also adds and removes modal grab as the mouse button is pressed and released, so that it can detect the end of a drag outside the window. Today I found that this widget no longer receives motion events, only press and release events. Adding GDK_POINTER_MOTION_MASK brings back motion events, but I do not want to receive them while no buttons are pressed! This is a regression from 2.16, possibly resulting from the extensive changes to support XInput. Ben. -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: i386 (x86_64) Kernel: Linux 2.6.31-trunk-amd64 (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages libgtk2.0-0 depends on: ii libatk1.0-0 1.28.0-1 The ATK accessibility toolkit ii libc6 2.10.1-5 GNU C Library: Shared libraries ii libcairo2 1.8.8-2 The Cairo 2D vector graphics libra ii libcups2 1.4.1-5 Common UNIX Printing System(tm) - ii libfontconfig1 2.6.0-4 generic font configuration library ii libfreetype6 2.3.11-1 FreeType 2 font engine, shared lib ii libglib2.0-0 2.22.2-2 The GLib library of C routines ii libgnutls26 2.8.4-2 the GNU TLS library - runtime libr ii libgssapi-krb5-2 1.7dfsg~beta3-1 MIT Kerberos runtime libraries - k ii libgtk2.0-common 2.18.3-1 Common files for the GTK+ graphica ii libjasper1 1.900.1-6 The JasPer JPEG-2000 runtime libra ii libjpeg62 6b-15 The Independent JPEG Group's JPEG ii libpango1.0-0 1.26.0-1 Layout and rendering of internatio ii libpng12-0 1.2.40-1 PNG library - runtime ii libtiff4 3.9.1-1 Tag Image File Format (TIFF) libra ii libx11-6 2:1.2.2-1 X11 client-side library ii libxcomposite1 1:0.4.0-4 X11 Composite extension library ii libxcursor1 1:1.1.9-1 X cursor management library ii libxdamage1 1:1.1.1-4 X11 damaged region extension libra ii libxext6 2:1.0.4-1 X11 miscellaneous extension librar ii libxfixes3 1:4.0.3-2 X11 miscellaneous 'fixes' extensio ii libxi6 2:1.2.1-2 X11 Input extension library ii libxinerama1 2:1.0.3-2 X11 Xinerama extension library ii libxrandr2 2:1.3.0-2 X11 RandR extension library ii libxrender1 1:0.9.4-2 X Rendering Extension client libra ii shared-mime-info 0.60-2 FreeDesktop.org shared MIME databa ii zlib1g 1:1.2.3.3.dfsg-15 compression library - runtime Versions of packages libgtk2.0-0 recommends: ii hicolor-icon-theme 0.10-2 default fallback theme for FreeDes ii libgtk2.0-bin 2.18.3-1 The programs for the GTK+ graphica Versions of packages libgtk2.0-0 suggests: ii gvfs 1.4.1-2 userspace virtual filesystem - ser ii librsvg2-common 2.26.0-1 SAX-based renderer library for SVG -- no debconf information
Does setting the env var GDK_NATIVE_WINDOWS to 1 fix it?
It does.
Created attachment 148811 [details] Working test case I made a simple test case (attached), and it works. I think the problem is related to the grabs you mention. However, i'm unable to find the code you cite in the dvswitch codebase. Can you point me to it, or ever better modify my testcase to what you do so it stops working.
252 // dv_full_display_widget 253 254 dv_full_display_widget::dv_full_display_widget() 255 : pix_fmt_(PIX_FMT_NONE), 256 height_(0), 257 xv_port_(invalid_xv_port), 258 xv_image_(0), 259 xv_shm_info_(0), 260 // We don't know what the frame format will be, but assume "PAL" 261 // 4:3 frames and therefore an active image size of 702x576 and 262 // pixel aspect ratio of 59:54. 263 dest_width_(767), dest_height_(576), 264 sel_enabled_(false), 265 sel_in_progress_(false) 266 { 267 std::memset(&source_region_, 0, sizeof(source_region_)); 268 std::memset(&selection_, 0, sizeof(selection_)); 269 270 set_size_request(dest_width_, dest_height_); 271 272 add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK 273 | Gdk::BUTTON1_MOTION_MASK | Gdk::BUTTON2_MOTION_MASK); 274 } 275 http://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=dvswitch/dvswitch.git;a=blob;f=src/dv_display_widget.cpp;h=bcc9454eb38d97d96e208f356f0483229d7ec545;hb=HEAD#l272 I skimmed over it and don't see a difference. will look more throughly in the next day or 2.
I will defer to someone who knows C/C++ - I cant figure out hot to register the callback: event_grabber... g_print("Motion: %.1f,%.1f\n", event->x, event->y);... If someone will take a shot at it, I'll try to get it working. dvswitch isn't easy to run out of the box - it needs some dv inputs, either a dv cam or a dvfile, and then you need to run 2 commands with a handfull of parameters in order to have something to test this bug. I have some python code that will take care of all this, but lets not complicate things yet.
Not sure what you mean by "register the callback". The example code already does this in main() by: g_signal_connect(widget, "motion-notify-event", G_CALLBACK(event_grabber), NULL); And i get these lines printed in the example app when i move the mouse around with the button down.
Created attachment 148888 [details] Test case showing the bug Ah, its due to the child window being native. Attached an example case that shows the broken behaviour.
Fixed in master (b509f28559dba03684ecc88acac498b6f27d2ebf) and on the 2.18 branch.
Thanks Alex, That does indeed fix the problem were were seeing. I would like to get this patch into Ubuntu Karmic, so I need a test that shows it is broken before the patch, fixed after. Can you change https://bugzilla.gnome.org/attachment.cgi?id=148811 so that it demos the bug? and if you don't have an unpatched system, take a guess and I will get it working.
https://bugzilla.gnome.org/attachment.cgi?id=148888 demos the bug
*** Bug 603849 has been marked as a duplicate of this bug. ***