summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorosch <oliver at luced de>2019-05-24 20:34:16 +0200
committerraveit65 <[email protected]>2019-06-03 14:14:38 +0200
commit707eb409e7dfeec276f6dfa3e667a0140b3300aa (patch)
tree88eb1ef90de077b0b94736a83943480d81378ec4 /src
parent11b7ff55b020573b3ecf4e841c2b1d60ca74f4b8 (diff)
downloadmarco-707eb409e7dfeec276f6dfa3e667a0140b3300aa.tar.bz2
marco-707eb409e7dfeec276f6dfa3e667a0140b3300aa.tar.xz
alt+tab popup: bugfix mouse click handling for scale factor > 1
Diffstat (limited to 'src')
-rw-r--r--src/core/display.c30
-rw-r--r--src/include/tabpopup.h3
-rw-r--r--src/ui/tabpopup.c10
3 files changed, 28 insertions, 15 deletions
diff --git a/src/core/display.c b/src/core/display.c
index 65ae1885..216688ec 100644
--- a/src/core/display.c
+++ b/src/core/display.c
@@ -1611,18 +1611,30 @@ mouse_event_is_in_tab_popup (MetaDisplay *display,
event_window, event_window,
event_x, event_y,
&x, &y, &child1);
+
+ GtkWidget *popup_widget = meta_ui_tab_popup_get_widget (screen->tab_popup);
+ if (ok1 && popup_widget != NULL)
+ {
+ Window popup_xid = gdk_x11_window_get_xid (gtk_widget_get_window (popup_widget));
- Window popup_xid = meta_ui_tab_popup_get_xid(screen->tab_popup);
-
- gboolean ok2 = XTranslateCoordinates (display->xdisplay,
- event_window, popup_xid,
- event_x, event_y,
- popup_x, popup_y, &child2);
+ gboolean ok2 = XTranslateCoordinates (display->xdisplay,
+ event_window, popup_xid,
+ event_x, event_y,
+ popup_x, popup_y, &child2);
- return (ok1 && ok2 && child1 == popup_xid);
+ if (ok2 && child1 == popup_xid)
+ {
+ int scale = gtk_widget_get_scale_factor (popup_widget);
+ if (scale != 0)
+ {
+ *popup_x /= scale;
+ *popup_y /= scale;
+ }
+ return TRUE;
+ }
+ }
}
- else
- return FALSE;
+ return FALSE;
}
/**
diff --git a/src/include/tabpopup.h b/src/include/tabpopup.h
index 077ec909..a93d1b2d 100644
--- a/src/include/tabpopup.h
+++ b/src/include/tabpopup.h
@@ -31,6 +31,7 @@
#include <X11/Xlib.h>
#include <glib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gtk/gtk.h>
typedef struct _MetaTabEntry MetaTabEntry;
typedef struct _MetaTabPopup MetaTabPopup;
@@ -69,7 +70,7 @@ void meta_ui_tab_popup_up (MetaTabPopup *popup);
MetaTabEntryKey meta_ui_tab_popup_get_selected (MetaTabPopup *popup);
void meta_ui_tab_popup_select (MetaTabPopup *popup,
MetaTabEntryKey key);
-Window meta_ui_tab_popup_get_xid (MetaTabPopup *popup);
+GtkWidget* meta_ui_tab_popup_get_widget (MetaTabPopup *popup);
void meta_ui_tab_popup_mouse_press (MetaTabPopup *popup,
gint x,
gint y);
diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c
index b896b0e3..d7887ca8 100644
--- a/src/ui/tabpopup.c
+++ b/src/ui/tabpopup.c
@@ -640,13 +640,13 @@ meta_ui_tab_popup_select (MetaTabPopup *popup,
}
}
-Window
-meta_ui_tab_popup_get_xid (MetaTabPopup *popup)
+GtkWidget*
+meta_ui_tab_popup_get_widget (MetaTabPopup *popup)
{
- if (popup != NULL && popup->window != NULL)
- return gdk_x11_window_get_xid(gtk_widget_get_window(popup->window));
+ if (popup != NULL)
+ return popup->window;
else
- return 0;
+ return NULL;
}
void