[gtk+] Remove support for GDK_NATIVE_WINDOWS



commit a3b2840cae2fa82aa1e7a1851238b798f084df5c
Author: Alexander Larsson <alexl redhat com>
Date:   Mon Mar 7 16:01:46 2011 +0100

    Remove support for GDK_NATIVE_WINDOWS
    
    GDK_NATIVE_WINDOWS was a way to keep some old apps running that did weird
    things in gtk2. We should not have to carry this forwards in gtk 3.x.
    
    We do however keep a g_warning() call reminding people of this fact to
    ease debugging when they try to port their applications.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=644119

 docs/reference/gtk/running.sgml |   10 ----
 gdk/gdk.c                       |    4 +-
 gdk/gdkdevice.c                 |    5 +--
 gdk/gdkdisplay.c                |    4 --
 gdk/gdkglobals.c                |    1 -
 gdk/gdkinternals.h              |    1 -
 gdk/gdkwindow.c                 |   96 ++++-----------------------------------
 gdk/win32/gdkwindow-win32.c     |    1 -
 8 files changed, 12 insertions(+), 110 deletions(-)
---
diff --git a/docs/reference/gtk/running.sgml b/docs/reference/gtk/running.sgml
index 74a0a37..899f765 100644
--- a/docs/reference/gtk/running.sgml
+++ b/docs/reference/gtk/running.sgml
@@ -382,16 +382,6 @@ nevertheless.
 </formalpara>
 
 <formalpara>
-  <title><envar>GDK_NATIVE_WINDOWS</envar></title>
-
-  <para>
-    If set, GDK creates all windows as native windows. This can help
-    applications that make assumptions about 1-1 correspondence between
-    GDK windows and X11 windows.
-  </para>
-</formalpara>
-
-<formalpara>
   <title><envar>GDK_BACKEND</envar></title>
 
   <para>
diff --git a/gdk/gdk.c b/gdk/gdk.c
index e65f68b..43d45f5 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -236,8 +236,8 @@ gdk_pre_parse_libgtk_only (void)
 
   if (getenv ("GDK_NATIVE_WINDOWS"))
     {
-      _gdk_native_windows = TRUE;
-      /* Ensure that this is not propagated to spawned applications */
+      g_warning ("The GDK_NATIVE_WINDOWS environment variable is not supported in GTK3.\n"
+                 "See the documentation for gdk_window_ensure_native() on how to get native windows.");
       g_unsetenv ("GDK_NATIVE_WINDOWS");
     }
 
diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c
index 8106bea..227c75c 100644
--- a/gdk/gdkdevice.c
+++ b/gdk/gdkdevice.c
@@ -1216,10 +1216,7 @@ gdk_device_grab (GdkDevice        *device,
   g_return_val_if_fail (GDK_IS_DEVICE (device), GDK_GRAB_SUCCESS);
   g_return_val_if_fail (GDK_IS_WINDOW (window), GDK_GRAB_SUCCESS);
 
-  if (_gdk_native_windows)
-    native = window;
-  else
-    native = gdk_window_get_toplevel (window);
+  native = gdk_window_get_toplevel (window);
 
   while (native->window_type == GDK_WINDOW_OFFSCREEN)
     {
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c
index f8fce31..8c41541 100644
--- a/gdk/gdkdisplay.c
+++ b/gdk/gdkdisplay.c
@@ -764,10 +764,6 @@ synthesize_crossing_events (GdkDisplay      *display,
   GdkModifierType state;
   int x, y;
 
-  /* We use the native crossing events if all native */
-  if (_gdk_native_windows)
-    return;
-  
   if (src_window)
     src_toplevel = gdk_window_get_toplevel (src_window);
   else
diff --git a/gdk/gdkglobals.c b/gdk/gdkglobals.c
index 085568f..32a0253 100644
--- a/gdk/gdkglobals.c
+++ b/gdk/gdkglobals.c
@@ -36,6 +36,5 @@ guint               _gdk_debug_flags = 0;
 GList              *_gdk_default_filters = NULL;
 gchar              *_gdk_display_name = NULL;
 gchar              *_gdk_display_arg_name = NULL;
-gboolean            _gdk_native_windows = FALSE;
 gboolean            _gdk_disable_multidevice = FALSE;
 
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index bb33e09..790763b 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -91,7 +91,6 @@ extern GList            *_gdk_default_filters;
 extern GdkWindow        *_gdk_parent_root;
 
 extern guint _gdk_debug_flags;
-extern gboolean _gdk_native_windows;
 
 #ifdef G_ENABLE_DEBUG
 
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index d74126d..57a3187 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -920,14 +920,8 @@ recompute_visible_regions_internal (GdkWindow *private,
 	    {
 	      cairo_region_intersect (new_clip, private->parent->clip_region);
 
-	      /* Remove all overlapping children from parent.
-	       * Unless we're all native, because then we don't need to take
-	       * siblings into account since X does that clipping for us.
-	       * This makes things like SWT that modify the raw X stacking
-	       * order without GDKs knowledge work.
-	       */
-	      if (!_gdk_native_windows)
-		remove_child_area (private->parent, private, FALSE, new_clip);
+	      /* Remove all overlapping children from parent. */
+	      remove_child_area (private->parent, private, FALSE, new_clip);
 	    }
 
 	  /* Convert from parent coords to window coords */
@@ -1146,8 +1140,7 @@ get_native_device_event_mask (GdkWindow *private,
   else
     event_mask = private->event_mask;
 
-  if (_gdk_native_windows ||
-      private->window_type == GDK_WINDOW_ROOT ||
+  if (private->window_type == GDK_WINDOW_ROOT ||
       private->window_type == GDK_WINDOW_FOREIGN)
     return event_mask;
   else
@@ -1288,13 +1281,6 @@ gdk_window_new (GdkWindow     *parent,
       return NULL;
     }
 
-  if (attributes->window_type == GDK_WINDOW_OFFSCREEN &&
-      _gdk_native_windows)
-    {
-      g_warning ("Offscreen windows not supported with native-windows gdk");
-      return NULL;
-    }
-
   display = gdk_screen_get_display (screen);
 
   window = _gdk_display_create_window (display);
@@ -1384,7 +1370,7 @@ gdk_window_new (GdkWindow     *parent,
   window->device_cursor = g_hash_table_new_full (NULL, NULL,
                                                  NULL, g_object_unref);
 
-  native = _gdk_native_windows; /* Default */
+  native = FALSE;
   if (window->parent->window_type == GDK_WINDOW_ROOT)
     native = TRUE; /* Always use native windows for toplevels */
   else if (!window->input_only &&
@@ -2639,9 +2625,6 @@ gdk_window_begin_implicit_paint (GdkWindow *window, GdkRectangle *rect)
 
   g_assert (gdk_window_has_impl (window));
 
-  if (_gdk_native_windows)
-    return FALSE; /* No need for implicit paints since we can't merge draws anyway */
-
   if (GDK_IS_PAINTABLE (window->impl))
     return FALSE; /* Implementation does double buffering */
 
@@ -5143,8 +5126,7 @@ set_viewable (GdkWindow *w,
 	set_viewable (child, val);
     }
 
-  if (!_gdk_native_windows &&
-      gdk_window_has_impl (w)  &&
+  if (gdk_window_has_impl (w)  &&
       w->window_type != GDK_WINDOW_FOREIGN &&
       !gdk_window_is_toplevel (w))
     {
@@ -5169,9 +5151,6 @@ set_viewable (GdkWindow *w,
        * do the show ourselves. We can't really tell this case from the normal
        * toplevel show as such toplevels are seen by gdk as parents of the
        * root window, so we make an exception for all toplevels.
-       *
-       * Also, when in GDK_NATIVE_WINDOW mode we never need to play games
-       * like this, so we just always show/hide directly.
        */
 
       impl_class = GDK_WINDOW_IMPL_GET_CLASS (w->impl);
@@ -5843,10 +5822,7 @@ gdk_window_set_device_events (GdkWindow    *window,
     g_hash_table_insert (window->device_events, device,
                          GINT_TO_POINTER (event_mask));
 
-  if (_gdk_native_windows)
-    native = window;
-  else
-    native = gdk_window_get_toplevel (window);
+  native = gdk_window_get_toplevel (window);
 
   while (gdk_window_is_offscreen (native))
     {
@@ -6596,8 +6572,7 @@ update_cursor_foreach (GdkDisplay           *display,
 {
   GdkWindow *window = user_data;
 
-  if (_gdk_native_windows ||
-      window->window_type == GDK_WINDOW_ROOT ||
+  if (window->window_type == GDK_WINDOW_ROOT ||
       window->window_type == GDK_WINDOW_FOREIGN)
     GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_device_cursor (window, device, window->cursor);
   else if (_gdk_window_event_parent_of (window, pointer_info->window_under_pointer))
@@ -8569,11 +8544,6 @@ _gdk_display_set_window_under_pointer (GdkDisplay *display,
 {
   GdkPointerWindowInfo *device_info;
 
-  /* We don't track this if all native, and it can cause issues
-     with the update_cursor call below */
-  if (_gdk_native_windows)
-    return;
-
   device_info = _gdk_display_get_pointer_info (display, device);
 
   if (device_info->window_under_pointer)
@@ -8672,10 +8642,7 @@ gdk_pointer_grab (GdkWindow *	  window,
       !gdk_window_is_viewable (window))
     return GDK_GRAB_NOT_VIEWABLE;
 
-  if (_gdk_native_windows)
-    native = window;
-  else
-    native = gdk_window_get_toplevel (window);
+  native = gdk_window_get_toplevel (window);
   while (gdk_window_is_offscreen (native))
     {
       native = gdk_offscreen_window_get_embedder (native);
@@ -8775,10 +8742,7 @@ gdk_keyboard_grab (GdkWindow *window,
       !gdk_window_is_viewable (window))
     return GDK_GRAB_NOT_VIEWABLE;
 
-  if (_gdk_native_windows)
-    native = window;
-  else
-    native = gdk_window_get_toplevel (window);
+  native = gdk_window_get_toplevel (window);
 
   while (gdk_window_is_offscreen (native))
     {
@@ -9047,9 +9011,6 @@ _gdk_synthesize_crossing_events_for_geometry_change (GdkWindow *changed_window)
 {
   GdkWindow *toplevel;
 
-  if (_gdk_native_windows)
-    return; /* We use the native crossing events if all native */
-
   toplevel = get_event_toplevel (changed_window);
 
   if (!toplevel->synthesize_crossing_event_queued)
@@ -9584,45 +9545,6 @@ _gdk_windowing_got_event (GdkDisplay *display,
     }
 #endif
 
-  if (_gdk_native_windows)
-    {
-      if (event->type == GDK_BUTTON_PRESS &&
-	  !event->any.send_event &&
-	  _gdk_display_has_device_grab (display, device, serial) == NULL)
-	{
-	  _gdk_display_add_device_grab  (display,
-                                         device,
-                                         event_window,
-                                         event_window,
-                                         GDK_OWNERSHIP_NONE,
-                                         FALSE,
-                                         gdk_window_get_events (event_window),
-                                         serial,
-                                         gdk_event_get_time (event),
-                                         TRUE);
-	  _gdk_display_device_grab_update (display, device, source_device, serial);
-	}
-      if (event->type == GDK_BUTTON_RELEASE &&
-	  !event->any.send_event)
-	{
-	  button_release_grab =
-            _gdk_display_has_device_grab (display, device, serial);
-	  if (button_release_grab &&
-	      button_release_grab->implicit &&
-	      (event->button.state & GDK_ANY_BUTTON_MASK & ~(GDK_BUTTON1_MASK << (event->button.button - 1))) == 0)
-	    {
-	      button_release_grab->serial_end = serial;
-	      button_release_grab->implicit_ungrab = FALSE;
-	      _gdk_display_device_grab_update (display, device, source_device, serial);
-	    }
-	}
-
-      if (event->type == GDK_BUTTON_PRESS)
-	_gdk_event_button_generate (display, event);
-
-      return;
-    }
-
   if (event->type == GDK_VISIBILITY_NOTIFY)
     {
       event_window->native_visibility = event->visibility.state;
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 6da0c09..5e2208f 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -404,7 +404,6 @@ RegisterGdkClass (GdkWindowType wtype, GdkWindowTypeHint wtype_hint)
  * Create native windows.
  *
  * With the default Gdk the created windows are mostly toplevel windows.
- * A lot of child windows are only created for GDK_NATIVE_WINDOWS.
  *
  * Placement of the window is derived from the passed in window,
  * except for toplevel window where OS/Window Manager placement



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]