Re: Win32 - handling mainloop while showing modal comon controls



FWIW,

We've solved a similar issue when using e.g. the standard open file/save
file Windows dialog in a different way.

This is also not ideal but works fine in practice, and is not bound to
any specific dialog.

Here it is attached (this is a patch against 2.8.17 sources).

Arno
	* gdk/win32/gdkevents-win32.c: Force an update when paint message
	is received, otherwise windows in background are not immediately
	refreshed when moving a modal window on top of them.
	Add handling of WM_NCPAINT message to refresh some areas when a window
	from another application is moved on top of the current app.

--- gdk/win32/gdkevents-win32.c.old	2006-02-21 10:02:58.000000000 +0100
+++ gdk/win32/gdkevents-win32.c	2006-02-21 10:08:22.000000000 +0100
@@ -2125,6 +2125,12 @@ handle_wm_paint (MSG        *msg,
   _gdk_window_process_expose (window, update_region);
   gdk_region_destroy (update_region);
 
+  /* Force a process_updates to refresh visible windows
+   * when receiving a paint message. */
+
+  if (!GDK_WINDOW_DESTROYED (window) && gdk_window_is_visible (window))
+    gdk_window_process_updates (window, FALSE);
+
   DeleteObject (hrgn);
 }
 
@@ -2964,6 +2970,35 @@ gdk_event_translate (MSG  *msg,
       *ret_valp = 1;
       break;
 
+    case WM_NCPAINT:
+      if (msg->wParam < 1)
+	break;
+
+      {
+	HRGN hrgn;
+
+	hrgn = CreateRectRgn (0, 0, 0, 0);
+	if (GetUpdateRgn (msg->hwnd, hrgn, FALSE) == ERROR)
+	  {
+	    WIN32_GDI_FAILED ("GetUpdateRgn");
+	    break;
+	  }
+
+	{
+	  GdkRegion *update_region = _gdk_win32_hrgn_to_region (hrgn);
+
+	  _gdk_windowing_window_get_offsets (window, &xoffset, &yoffset);
+	  gdk_region_offset (update_region, xoffset, yoffset);
+
+	  _gdk_window_process_expose (window, update_region);
+	  gdk_region_destroy (update_region);
+
+	  DeleteObject (hrgn);
+	  return_val = FALSE;
+	}
+      }
+      break;
+
     case WM_PAINT:
       handle_wm_paint (msg, window, FALSE, NULL);
       break;


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