예제 #1
0
파일: grabs.c 프로젝트: burzumishi/e16
void
GrabButtonRelease(unsigned int button, unsigned int modifiers, Win win)
{
   int                 i;

#if USE_XI2
   XIGrabModifiers     modifiers_inouts[8];
   int                 num_modifiers;

   if (modifiers == AnyModifier)
     {
	num_modifiers = 1;
	modifiers_inouts[0].modifiers = XIAnyModifier;
	modifiers_inouts[0].status = 0;
     }
   else
     {
	num_modifiers = 0;
	for (i = 0; i < 8; i++)
	  {
	     if (i && !Mode.masks.mod_combos[i])
		continue;
	     modifiers_inouts[num_modifiers].modifiers =
		modifiers | Mode.masks.mod_combos[i];
	     modifiers_inouts[num_modifiers].status = 0;
	     num_modifiers++;
	  }
     }
   XIUngrabButton(disp, DEV_PTR, button, WinGetXwin(win),
		  num_modifiers, modifiers_inouts);
#else
   if (modifiers == AnyModifier)
     {
	XUngrabButton(disp, button, modifiers, WinGetXwin(win));
	return;
     }

   for (i = 0; i < 8; i++)
     {
	if (i && !Mode.masks.mod_combos[i])
	   continue;
	XUngrabButton(disp, button, modifiers | Mode.masks.mod_combos[i],
		      WinGetXwin(win));
     }
#endif
}
예제 #2
0
void
grab_button (int        deviceid,
             gboolean   grab,
             GdkScreen *screen)
{
	GdkWindow *root;
	XIGrabModifiers mods;

	root = gdk_screen_get_root_window (screen);
	mods.modifiers = XIAnyModifier;

	if (grab) {
		XIEventMask evmask;
		unsigned char mask[(XI_LASTEVENT + 7)/8];

		memset (mask, 0, sizeof (mask));
		XISetMask (mask, XI_ButtonRelease);
		XISetMask (mask, XI_ButtonPress);

		evmask.deviceid = deviceid;
		evmask.mask_len = sizeof (mask);
		evmask.mask = mask;

		gdk_error_trap_push();
		XIGrabButton (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
			      deviceid,
			      XIAnyButton,
			      GDK_WINDOW_XID (root),
			      None,
			      GrabModeAsync,
			      GrabModeAsync,
			      False,
			      &evmask,
			      1,
			      &mods);
		gdk_error_trap_pop_ignored ();
	} else {
		gdk_error_trap_push();
		XIUngrabButton (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
				deviceid,
				XIAnyButton,
		                GDK_WINDOW_XID (root),
				1, &mods);
		gdk_error_trap_pop_ignored ();
	}
}
예제 #3
0
파일: device.c 프로젝트: iglosiggio/xfwm4
void
xfwm_device_ungrab_button (XfwmDevices *devices, Display *display,
                           guint button, guint modifiers, Window grab_window)
{
#ifdef HAVE_XI2
    XIGrabModifiers xi2_modifiers;
#endif

#ifdef HAVE_XI2
    if (devices->xi2_available)
    {
        xi2_modifiers.modifiers = xi2_modifier_mask (modifiers);
        xi2_modifiers.status = 0;

        XIUngrabButton (display, devices->pointer.xi2_device, button,
                        grab_window, 1, &xi2_modifiers);
    }
    else
#endif
    {
        XUngrabButton (display, button, modifiers, grab_window);
    }
}