You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wxGTK3/wxGTK3-3.0.2-wayland.patch

109 lines
5.1 KiB

diff -rupN wxWidgets-3.0.2/src/gtk/toplevel.cpp wxWidgets-3.0.2-wayland/src/gtk/toplevel.cpp
--- wxWidgets-3.0.2/src/gtk/toplevel.cpp 2014-10-06 17:33:44.000000000 -0400
+++ wxWidgets-3.0.2-wayland/src/gtk/toplevel.cpp 2015-12-31 14:48:25.873812357 -0500
@@ -456,8 +456,12 @@ gtk_frame_window_state_callback( GtkWidg
bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int* bottom)
{
#ifdef GDK_WINDOWING_X11
- static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false);
GdkDisplay* display = gdk_window_get_display(window);
+
+ if (!GDK_IS_X11_DISPLAY(display))
+ return false;
+
+ static GdkAtom property = gdk_atom_intern("_NET_FRAME_EXTENTS", false);
Atom xproperty = gdk_x11_atom_to_xatom_for_display(display, property);
Atom type;
int format;
@@ -852,10 +856,19 @@ bool wxTopLevelWindowGTK::ShowFullScreen
m_fsIsShowing = show;
+ wxX11FullScreenMethod method = wxX11_FS_WMSPEC;
+ Display* xdpy = NULL;
+ Window xroot = None;
+
#ifdef GDK_WINDOWING_X11
- Display* xdpy = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(m_widget));
- Window xroot = GDK_WINDOW_XID(gtk_widget_get_root_window(m_widget));
- wxX11FullScreenMethod method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot);
+ GdkDisplay *display = gtk_widget_get_display(m_widget);
+
+ if (GDK_IS_X11_DISPLAY(display))
+ {
+ xdpy = GDK_DISPLAY_XDISPLAY(gtk_widget_get_display(m_widget));
+ xroot = GDK_WINDOW_XID(gtk_widget_get_root_window(m_widget));
+ method = wxGetFullScreenMethodX11(xdpy, (WXWindow)xroot);
+ }
// NB: gtk_window_fullscreen() uses freedesktop.org's WMspec extensions
// to switch to fullscreen, which is not always available. We must
@@ -870,7 +883,7 @@ bool wxTopLevelWindowGTK::ShowFullScreen
gtk_window_unfullscreen( GTK_WINDOW( m_widget ) );
}
#ifdef GDK_WINDOWING_X11
- else
+ else if (xdpy != NULL)
{
GdkWindow* window = gtk_widget_get_window(m_widget);
Window xid = GDK_WINDOW_XID(window);
@@ -958,6 +971,7 @@ bool wxTopLevelWindowGTK::Show( bool sho
deferShow = m_deferShowAllowed &&
gs_requestFrameExtentsStatus != RFE_STATUS_BROKEN &&
!gtk_widget_get_realized(m_widget) &&
+ GDK_IS_X11_DISPLAY(gtk_widget_get_display(m_widget)) &&
g_signal_handler_find(m_widget,
GSignalMatchType(G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DATA),
g_signal_lookup("property_notify_event", GTK_TYPE_WIDGET),
diff -rupN wxWidgets-3.0.2/src/gtk/window.cpp wxWidgets-3.0.2-wayland/src/gtk/window.cpp
--- wxWidgets-3.0.2/src/gtk/window.cpp 2014-10-06 17:33:44.000000000 -0400
+++ wxWidgets-3.0.2-wayland/src/gtk/window.cpp 2015-12-31 14:48:31.522812743 -0500
@@ -780,28 +780,31 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& e
}
#ifdef GDK_WINDOWING_X11
- // we want to always get the same key code when the same key is
- // pressed regardless of the state of the modifiers, i.e. on a
- // standard US keyboard pressing '5' or '%' ('5' key with
- // Shift) should result in the same key code in OnKeyDown():
- // '5' (although OnChar() will get either '5' or '%').
- //
- // to do it we first translate keysym to keycode (== scan code)
- // and then back but always using the lower register
- Display *dpy = (Display *)wxGetDisplay();
- KeyCode keycode = XKeysymToKeycode(dpy, keysym);
+ if (GDK_IS_X11_DISPLAY(gdk_window_get_display(gdk_event->window)))
+ {
+ // we want to always get the same key code when the same key is
+ // pressed regardless of the state of the modifiers, i.e. on a
+ // standard US keyboard pressing '5' or '%' ('5' key with
+ // Shift) should result in the same key code in OnKeyDown():
+ // '5' (although OnChar() will get either '5' or '%').
+ //
+ // to do it we first translate keysym to keycode (== scan code)
+ // and then back but always using the lower register
+ Display *dpy = (Display *)wxGetDisplay();
+ KeyCode keycode = XKeysymToKeycode(dpy, keysym);
- wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode);
+ wxLogTrace(TRACE_KEYS, wxT("\t-> keycode %d"), keycode);
#ifdef HAVE_X11_XKBLIB_H
- KeySym keysymNormalized = XkbKeycodeToKeysym(dpy, keycode, 0, 0);
+ KeySym keysymNormalized = XkbKeycodeToKeysym(dpy, keycode, 0, 0);
#else
- KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0);
+ KeySym keysymNormalized = XKeycodeToKeysym(dpy, keycode, 0);
#endif
- // use the normalized, i.e. lower register, keysym if we've
- // got one
- key_code = keysymNormalized ? keysymNormalized : keysym;
+ // use the normalized, i.e. lower register, keysym if we've
+ // got one
+ key_code = keysymNormalized ? keysymNormalized : keysym;
+ }
#else
key_code = keysym;
#endif