@@ -514,9 +514,6 @@ gboolean disableGrab = FALSE;
514
514
static gboolean configure_transparent_window (GtkWidget *window);
515
515
static void configure_opaque_window (GtkWidget *window);
516
516
517
- static void grab_mouse_device (GdkDevice *device, DeviceGrabContext *context);
518
- static void ungrab_mouse_device (GdkDevice *device);
519
-
520
517
gint glass_gdk_visual_get_depth (GdkVisual * visual)
521
518
{
522
519
// gdk_visual_get_depth is GTK 2.2 +
@@ -535,35 +532,15 @@ GdkScreen * glass_gdk_window_get_screen(GdkWindow * gdkWindow)
535
532
536
533
gboolean
537
534
glass_gdk_mouse_devices_grab (GdkWindow *gdkWindow) {
538
- #ifdef GLASS_GTK3_DISABLED
539
- // this GTK 3 approach has synchronization issues covered in JDK-8176844
540
- // As the approach is also deprecated in GTK 3.20+, revert back to using GTK 2 mechanism
541
-
542
- if (disableGrab) {
543
- return TRUE ;
544
- }
545
- DeviceGrabContext context;
546
- GList *devices = gdk_device_manager_list_devices (
547
- gdk_display_get_device_manager (
548
- gdk_display_get_default ()),
549
- GDK_DEVICE_TYPE_MASTER);
550
-
551
- context.window = gdkWindow;
552
- context.grabbed = FALSE ;
553
- g_list_foreach (devices, (GFunc) grab_mouse_device, &context);
554
- g_list_free (devices);
555
-
556
- return context.grabbed ;
557
- #else
558
535
return glass_gdk_mouse_devices_grab_with_cursor (gdkWindow, NULL , TRUE );
559
- #endif
560
536
}
561
537
562
538
gboolean
563
539
glass_gdk_mouse_devices_grab_with_cursor (GdkWindow *gdkWindow, GdkCursor *cursor, gboolean owner_events) {
564
540
if (disableGrab) {
565
541
return TRUE ;
566
542
}
543
+
567
544
GdkGrabStatus status = gdk_pointer_grab (gdkWindow, owner_events, (GdkEventMask)
568
545
(GDK_POINTER_MOTION_MASK
569
546
| GDK_POINTER_MOTION_HINT_MASK
@@ -580,18 +557,7 @@ glass_gdk_mouse_devices_grab_with_cursor(GdkWindow *gdkWindow, GdkCursor *cursor
580
557
581
558
void
582
559
glass_gdk_mouse_devices_ungrab () {
583
- #ifdef GLASS_GTK3_DISABLED
584
- // this GTK 3 approach has synchronization issues covered in JDK-8176844
585
- // As the approach is also deprecated in GTK 3.20+, revert back to using GTK 2 mechanism
586
- GList *devices = gdk_device_manager_list_devices (
587
- gdk_display_get_device_manager (
588
- gdk_display_get_default ()),
589
- GDK_DEVICE_TYPE_MASTER);
590
- g_list_foreach (devices, (GFunc) ungrab_mouse_device, NULL );
591
- g_list_free (devices);
592
- #else
593
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
594
- #endif
560
+ gdk_pointer_ungrab (GDK_CURRENT_TIME);
595
561
}
596
562
597
563
void
@@ -625,6 +591,7 @@ glass_gdk_device_ungrab(GdkDevice *device) {
625
591
#endif
626
592
}
627
593
594
+
628
595
GdkWindow *
629
596
glass_gdk_device_get_window_at_position (GdkDevice *device, gint *x, gint *y) {
630
597
#ifdef GLASS_GTK3
@@ -733,49 +700,6 @@ glass_configure_window_transparency(GtkWidget *window, gboolean transparent) {
733
700
return FALSE ;
734
701
}
735
702
736
- static void
737
- grab_mouse_device (GdkDevice *device, DeviceGrabContext *context) {
738
- GdkInputSource source = gdk_device_get_source (device);
739
- if (source == GDK_SOURCE_MOUSE) {
740
- #ifdef GLASS_GTK3
741
- GdkGrabStatus status = gdk_device_grab (device,
742
- context->window ,
743
- GDK_OWNERSHIP_NONE,
744
- TRUE ,
745
- GDK_FILTERED_EVENTS_MASK,
746
- NULL ,
747
- GDK_CURRENT_TIME);
748
- #else
749
- GdkGrabStatus status = GDK_GRAB_SUCCESS;
750
- /* FIXME reachable by 2?
751
- GdkGrabStatus status = gdk_device_grab(device,
752
- context->window,
753
- GDK_OWNERSHIP_NONE,
754
- TRUE,
755
- GDK_FILTERED_EVENTS_MASK,
756
- NULL,
757
- GDK_CURRENT_TIME);
758
- */
759
- #endif
760
- if (status == GDK_GRAB_SUCCESS) {
761
- context->grabbed = TRUE ;
762
- }
763
- }
764
- }
765
-
766
- static void
767
- ungrab_mouse_device (GdkDevice *device) {
768
- #ifdef GLASS_GTK3
769
- GdkInputSource source = gdk_device_get_source (device);
770
- if (source == GDK_SOURCE_MOUSE) {
771
- gdk_device_ungrab (device, GDK_CURRENT_TIME);
772
- }
773
- #else
774
- (void ) device;
775
- // not used on the GTK2 path
776
- #endif
777
- }
778
-
779
703
GdkPixbuf *
780
704
glass_pixbuf_from_window (GdkWindow *window,
781
705
gint srcx, gint srcy,
0 commit comments