After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 615853 - BadMatch when pressing keyboard volume keys while pointer in secondary X screen
BadMatch when pressing keyboard volume keys while pointer in secondary X screen
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2010-04-15 14:13 UTC by Claudio Saavedra
Modified: 2010-04-28 14:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
minimal test case (1000 bytes, text/x-csrc)
2010-04-15 20:57 UTC, Claudio Saavedra
  Details
Fix (1.26 KB, patch)
2010-04-15 21:14 UTC, Claudio Saavedra
committed Details | Review

Description Claudio Saavedra 2010-04-15 14:13:25 UTC
When I configure my laptop to use two separate X screens, move my mouse pointer to the secondary one and press any of the volume keys, gnome-settings-daemon receives a badmatch from X.

This is the stacktrace when I run gdb on gnome-settings-daemon --sync --no-daemon --debug. Breakpoint is set to gdk_x_error:

  • #0 gdk_x_error
    at /tmp/buildd/gtk+2.0-2.20.0/gdk/x11/gdkmain-x11.c line 439
  • #1 xkl_process_error
    from /usr/lib/libxklavier.so.16
  • #2 _XError
    at ../../src/XlibInt.c line 3103
  • #3 process_responses
    at ../../src/xcb_io.c line 214
  • #4 _XReply
    at ../../src/xcb_io.c line 464
  • #5 XSync
    at ../../src/Sync.c line 46
  • #6 _XSyncFunction
    at ../../src/Synchro.c line 35
  • #7 XShapeCombineMask
    from /usr/lib/libXext.so.6
  • #8 _gdk_windowing_get_shape_for_mask
    at /tmp/buildd/gtk+2.0-2.20.0/gdk/x11/gdkwindow-x11.c line 4658
  • #9 IA__gdk_window_input_shape_combine_mask
    at /tmp/buildd/gtk+2.0-2.20.0/gdk/gdkwindow.c line 8371
  • #10 ??
    from /usr/lib/gnome-settings-daemon-2.0/libmedia-keys.so
  • #11 IA__g_cclosure_marshal_VOID__VOID
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gmarshal.c line 77
  • #12 g_type_class_meta_marshal
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gclosure.c line 878
  • #13 IA__g_closure_invoke
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gclosure.c line 767
  • #14 signal_emit_unlocked_R
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gsignal.c line 3178
  • #15 IA__g_signal_emit_valist
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gsignal.c line 2981
  • #16 IA__g_signal_emit
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gsignal.c line 3038
  • #17 IA__gtk_widget_realize
    at /tmp/buildd/gtk+2.0-2.20.0/gtk/gtkwidget.c line 3501
  • #18 gtk_window_show
    at /tmp/buildd/gtk+2.0-2.20.0/gtk/gtkwindow.c line 4517
  • #19 ??
    from /usr/lib/gnome-settings-daemon-2.0/libmedia-keys.so
  • #20 IA__g_cclosure_marshal_VOID__VOID
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gmarshal.c line 77
  • #21 g_type_class_meta_marshal
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gclosure.c line 878
  • #22 IA__g_closure_invoke
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gclosure.c line 767
  • #23 signal_emit_unlocked_R
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gsignal.c line 3178
  • #24 IA__g_signal_emit_valist
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gsignal.c line 2981
  • #25 IA__g_signal_emit
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/gobject/gsignal.c line 3038
  • #26 IA__gtk_widget_show
    at /tmp/buildd/gtk+2.0-2.20.0/gtk/gtkwidget.c line 3185
  • #27 ??
    from /usr/lib/gnome-settings-daemon-2.0/libmedia-keys.so
  • #28 ??
    from /usr/lib/gnome-settings-daemon-2.0/libmedia-keys.so
  • #29 gdk_event_apply_filters
    at /tmp/buildd/gtk+2.0-2.20.0/gdk/x11/gdkevents-x11.c line 351
  • #30 gdk_event_translate
    at /tmp/buildd/gtk+2.0-2.20.0/gdk/x11/gdkevents-x11.c line 1028
  • #31 _gdk_events_queue
    at /tmp/buildd/gtk+2.0-2.20.0/gdk/x11/gdkevents-x11.c line 2305
  • #32 gdk_event_dispatch
    at /tmp/buildd/gtk+2.0-2.20.0/gdk/x11/gdkevents-x11.c line 2366
  • #33 g_main_dispatch
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/glib/gmain.c line 1960
  • #34 IA__g_main_context_dispatch
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/glib/gmain.c line 2513
  • #35 g_main_context_iterate
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/glib/gmain.c line 2591
  • #36 IA__g_main_loop_run
    at /build/buildd-glib2.0_2.24.0-1-i386-o5zIuQ/glib2.0-2.24.0/glib/gmain.c line 2799
  • #37 IA__gtk_main
    at /tmp/buildd/gtk+2.0-2.20.0/gtk/gtkmain.c line 1219
  • #38 main

Comment 1 Jens Granseuer 2010-04-15 14:31:27 UTC
> #  #19  ??
> from /usr/lib/gnome-settings-daemon-2.0/libmedia-keys.so

That would quite probably be the most useful bit...
Comment 2 Claudio Saavedra 2010-04-15 14:51:26 UTC
I know, but unfortunately Debian doesn't provide a debugging package for gnome-settings-daemon. Fortuantely, there is only one place where gdk_window_input_shape_combine_mask() gets called in the whole gsd code:

gsd_media_keys_window_real_realize (), gsd-media-keys-window.c: 891

(looking at the sources for 2.28.1)
Comment 3 Bastien Nocera 2010-04-15 15:27:53 UTC
That code has been there for about two years, and only in the composited case:
commit c125c5a50ad229ea386277c582a809681d4dbfb3
Author: Carlos Garnacho <carlosg@gnome.org>
Date:   Wed May 7 23:30:58 2008 +0000

    New function, sets a fully transparent input shape, so that clicks go
    
    2008-05-08  Carlos Garnacho  <carlosg@gnome.org>
    
            * plugins/media-keys/gsd-media-keys-window.c
            (gsd_media_keys_window_real_realize): New function, sets a fully
            transparent input shape, so that clicks go through the media keys
            windows. Bug #531862.
            (gsd_media_keys_window_class_init): The usual glue.

The docs for XShapeCombineMask are rubbish though, and don't say when it would fail with a BadMatch. Maybe the window needs to be forced as native?
Comment 4 Claudio Saavedra 2010-04-15 15:58:45 UTC
Hm, but I am not running a composite window manager, just plain metacity.
Comment 5 Bastien Nocera 2010-04-15 16:07:42 UTC
With compositing enabled? :)

If not, it's probably Federico's fault then.
Comment 6 Claudio Saavedra 2010-04-15 16:12:01 UTC
Well, I am meant without compositing of course. :)

Calling Federico then.
Comment 7 Ray Strode [halfline] 2010-04-15 17:48:49 UTC
Seems to be a gtk bug:

-8<----
GdkRegion *
_gdk_windowing_get_shape_for_mask (GdkBitmap *mask)
{
  GdkDisplay *display;
  Window window;
  GdkRegion *region;

  display = gdk_drawable_get_display (GDK_DRAWABLE (mask));

  window = XCreateSimpleWindow (GDK_DISPLAY_XDISPLAY (display),
                                GDK_SCREEN_XROOTWIN (gdk_display_get_default_screen (display)),
                                -1, -1, 1, 1, 0,
                                0, 0);
  XShapeCombineMask (GDK_DISPLAY_XDISPLAY (display),
                     window,
                     ShapeBounding,
                     0, 0,
                     GDK_PIXMAP_XID (mask),
                     ShapeSet);
...
-->8---

Note, it's creating the window for the default screen, but using a passed in mask which could be for a different screen.

Probably just needs a gdk_drawable_get_screen call or similar.
Comment 8 Claudio Saavedra 2010-04-15 20:57:06 UTC
Created attachment 158836 [details]
minimal test case

This is enough to reproduce the bug. Run it from :0 display to see it getting a BadMatch (you need more than one screen). If you have one display it will work fine.
Comment 9 Claudio Saavedra 2010-04-15 20:57:33 UTC
(I mean, if you have one screen of course).
Comment 10 Claudio Saavedra 2010-04-15 21:14:19 UTC
Created attachment 158840 [details] [review]
Fix

Tested fix:

From a0a76cbc595d780d97fde2a5bc9126b8d7928ce8 Mon Sep 17 00:00:00 2001
From: Claudio Saavedra <csaavedra@igalia.com>
Date: Fri, 16 Apr 2010 00:12:29 +0300
Subject: [PATCH] Use the proper screen in _gdk_windowing_get_shape_for_mask()

Bug 615853 - BadMatch when pressing keyboard volume keys while pointer in secondary X screen

_gdk_windowing_get_shape_for_mask() is using the default screen, not taking into
account that its GdkBitmap could have been created for a different one, causing
BadMatch errors.
---
 gdk/x11/gdkwindow-x11.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Comment 11 Matthias Clasen 2010-04-19 15:49:49 UTC
Comment on attachment 158840 [details] [review]
Fix

Looks good
Comment 12 Claudio Saavedra 2010-04-19 15:56:34 UTC
Thanks, committed to gtk-2-20 and master.
Comment 13 Götz Waschk 2010-04-27 19:41:40 UTC
I have tried the patch from comment 11 with gtk 2.18.9, I can still reproduce the gnome-settings-daemon crash. The test case however is fine.
Comment 14 Claudio Saavedra 2010-04-27 22:10:27 UTC
A stacktrace would be nice.
Comment 15 Claudio Saavedra 2010-04-28 14:12:25 UTC
For the record, I home-brewed today a debian pacakge for 2.20.0-3 with this patch on top and the bug is fixed, so I suspect that you are probably hitting another bug that was fixed between 2.18.9 and this.
Comment 16 Götz Waschk 2010-04-28 14:18:56 UTC
Yes, looks like another bug related to connecting a second monitor and making gnome-settings-daemon crash. I'll open a new bug later.