Author: spitzak
Date: 2007-04-24 18:39:12 -0400 (Tue, 24 Apr 2007)
New Revision: 5783
Log:
Removed code that made maximize of windows on Windows not work.
Also removed dead code from the windows version.


Modified:
   trunk/src/win32/run.cxx

Modified: trunk/src/win32/run.cxx
===================================================================
--- trunk/src/win32/run.cxx     2007-04-18 17:39:56 UTC (rev 5782)
+++ trunk/src/win32/run.cxx     2007-04-24 22:39:12 UTC (rev 5783)
@@ -1441,10 +1441,6 @@
 static inline bool fl_select_palette(HDC) {return false;}
 #endif
 
-static Window* resize_from_system;
-//  static Window* in_wm_paint;
-//  static PAINTSTRUCT paint;
-
 extern void fl_prune_deferred_calls(HWND);
 HWND ignore_size_change_window;
 
@@ -1519,7 +1515,6 @@
     if (!window) break;
     CreatedWindow *i = CreatedWindow::find(window);
     i->wait_for_expose = false;
-#if 1
     // Merge the region into whatever is accumulated by fltk. I do this
     // by invalidating the fltk region and reading the resulting region
     // back:
@@ -1537,32 +1532,7 @@
     // and this minimizes the chances that will mess it up:
     MakeWaitReturn();
     //flush();
-#else
-    // This version was an attempt to fool fltk into doing what Windows
-    // wants, which is to draw immediately in response to the WM_PAINT
-    // event. This did not work as well as the above simpler version,
-    // and also appeared to be no faster.
-    // Since we can't merge or otherwise change the clip region, we
-    // must first get rid of any other damage before doing the drawing:
-    if (window->damage() || i->region) {
-      window->flush();
-      window->set_damage(0);
-      if (i->region) {XDestroyRegion(i->region); i->region = 0;}
-    }
-    // Now get the damage region, so fltk has some idea what area it
-    // needs to draw:
-    i->region = CreateRectRgn(0,0,0,0);
-    GetUpdateRgn(hWnd, i->region, 0);
-    // Now draw it using Windows' HDC and clip region:
-    BeginPaint(i->xid, &paint);
-    in_wm_paint = window; // makes it use the hdc from the paint struct
-    window->flush();
-    window->set_damage(0);
-    if (i->region) {XDestroyRegion(i->region); i->region = 0;}
-    EndPaint(i->xid, &paint);
-    in_wm_paint = 0;
-#endif
-    } break;
+    break;}
 
   case WM_LBUTTONDOWN: mouse_event(window, 0, 1, wParam, lParam); return 0;
   case WM_LBUTTONDBLCLK:mouse_event(window, 1, 1, wParam, lParam); return 0;
@@ -1688,15 +1658,11 @@
     if (!window) break;
     if (wParam) { // Map event
       if (window->parent()) break; // ignore child windows
+      // figure out where OS put automatically-placed windows:
       if (window->x()==USEDEFAULT || window->y()==USEDEFAULT) {
-       // figure out where OS really put window
        POINT wul = { 0, 0 }; ClientToScreen(xid(window), &wul);
-       // tell Window about it
        window->x(wul.x);
        window->y(wul.y);
-       //RECT wr; GetClientRect(xid(window), &wr);
-       //if (window->resize(wul.x, wul.y, wr.right, wr.bottom))
-       //   resize_from_system = window;
       }
       MakeWaitReturn();
     } else { // Unmap event
@@ -1716,21 +1682,18 @@
   case WM_WINDOWPOSCHANGING:
     {
       if (!window || window->parent()) break; // ignore child windows
+      // fltk does not think making a window iconic is a size change, but
+      // Windows does. This makes it ignore changes when the window is
+      // made iconic, and the "ignore_size_change_window" is used to
+      // ignore changes when it is de-iconized.
       if ( window->iconic() ) break;
       fltk::Rectangle r; window->borders(&r);
       WINDOWPOS *pos = (WINDOWPOS*)lParam;
       if (hWnd == ignore_size_change_window) {
        ignore_size_change_window = 0;
-       if (window->x()==USEDEFAULT)
-         window->x(pos->x-r.x());
-       else
-         pos->x = window->x()+r.x();
-       if (window->y()==USEDEFAULT)
-         window->y(pos->y-r.y());
-       else
-         pos->y = window->y()+r.y();
-       pos->cx = window->w()+r.w();
-       pos->cy = window->h()+r.h();
+        // Record the automatic position:
+       if (window->x()==USEDEFAULT) window->x(pos->x-r.x());
+       if (window->y()==USEDEFAULT) window->y(pos->y-r.y());
       } else {
        fltk::Rectangle newRect;
        if ( pos->flags & SWP_NOMOVE ) {
@@ -1759,43 +1722,6 @@
     }
     break;
 
-#if 0
-    // This was here before the WM_WINDOWPOSCHANGING case took care of
-    // it all.
-  case WM_MOVE:
-    if (!window || window->parent()) break; // ignore child windows
-# if 1
-    if (window->resize((signed short)LOWORD(lParam),
-                      (signed short)HIWORD(lParam),
-                      window->w(), window->h()))
-      resize_from_system = window;
-# else
-    // Faster version that does not bother with calling resize as the
-    // user drags the window around. This was what most Win32 versions
-    // of fltk did. This breaks programs that want to track the current
-    // position to figure out what corner is being resized when layout
-    // is called.
-    window->x((signed short)LOWORD(lParam));
-    window->y((signed short)HIWORD(lParam));
-# endif
-    MakeWaitReturn();
-    break;
-
-  case WM_SIZE:
-    if (window && !window->parent()) {
-      if (wParam == SIZE_MINIMIZED || wParam == SIZE_MAXHIDE) { // iconize
-       CreatedWindow::find(window)->wait_for_expose = true;
-      } else { // resize, deiconize
-       // supposedly a Paint event will come in turn off iconize indicator
-       if (window->resize(window->x(), window->y(),
-                          LOWORD(lParam), HIWORD(lParam)))
-         resize_from_system = window;
-      }
-    }
-    MakeWaitReturn();
-    break;
-#endif
-
   case WM_SETCURSOR:
     if (window && LOWORD(lParam) == HTCLIENT) {
       while (!window->is_window() && window->parent()) 
@@ -1832,13 +1758,8 @@
   case WM_DISPLAYCHANGE:
   case WM_SETTINGCHANGE:
     reload_info = true;
-#if USE_MULTIMONITOR
-    if ( monitors != &allMonitors ) {
+    if ( monitors != &allMonitors )
       delete[] monitors;
-    }
-#else
-    if (num_monitors > 1 && monitors != &allMonitors) delete[] monitors;
-#endif
     monitors = 0;
     num_monitors = 0;
   case WM_SYSCOLORCHANGE:
@@ -1954,11 +1875,11 @@
   } else {
     flags = 0;
   }
-  if (layout_damage() & ~LAYOUT_XY) Group::layout();
-  else layout_damage(0);
-  if (this == resize_from_system) {
-    resize_from_system = 0;
-  } else if (i && flags) {
+  if (layout_damage() & ~LAYOUT_XY)
+    Group::layout();
+  else
+    layout_damage(0);
+  if (i && flags) {
     fltk::Rectangle r(*this);
     borders(&r);
     r.x(r.x()+x());
@@ -2232,14 +2153,6 @@
   if (window->maxh) {
     minmax->ptMaxTrackSize.y =
       minmax->ptMaxSize.y = window->maxh + r.h();
-  } else {
-    // Is there a reason we don't just leave the Windows default max height?
-    // fabien: i think it is related to a minmax bug STR we had fixed many 
months ago :
-    //   the bug was about happening when moving  the taskbar ...
-    minmax->ptMaxTrackSize.y =
-       minmax->ptMaxSize.y = fltk::Monitor::all().h()-r.h();
-    // fltk::Monitor::all().work.h()-r.h() would leave space for taskbar
-    // but apparently Windows does this anyway
   }
 }
 

_______________________________________________
fltk-commit mailing list
fltk-commit@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to