[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57018] trunk/blender: Solving ancient Blender window sizing issue;

Ton Roosendaal ton at blender.org
Sat May 25 16:08:56 CEST 2013


Revision: 57018
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57018
Author:   ton
Date:     2013-05-25 14:08:56 +0000 (Sat, 25 May 2013)
Log Message:
-----------
Solving ancient Blender window sizing issue;

- Removed grid-snapping for area coordinates on scaling windows. 
  That caused the areas to shrink or expand, and eventually corrupt screen layouts.

- Added simple but efficient life resize for OSX. I need to know why this is so much
  code for Windows... I suggest Windows to just copy same method; dispatch the queue,
  and just let the event system draw.

Modified Paths:
--------------
    trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
    trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
    trunk/blender/source/blender/editors/screen/screen_edit.c
    trunk/blender/source/blender/windowmanager/intern/wm_window.c

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2013-05-25 13:34:21 UTC (rev 57017)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowCocoa.mm	2013-05-25 14:08:56 UTC (rev 57018)
@@ -53,17 +53,7 @@
 #endif
 
 #pragma mark Cocoa window delegate object
-/* live resize ugly patch
-extern "C" {
-	struct bContext;
-	typedef struct bContext bContext;
-	bContext* ghostC;
-	extern int wm_window_timer(const bContext *C);
-	extern void wm_window_process_events(const bContext *C);
-	extern void wm_event_do_handlers(bContext *C);
-	extern void wm_event_do_notifiers(bContext *C);
-	extern void wm_draw_update(bContext *C);
-};*/
+
 @interface CocoaWindowDelegate : NSObject
 <NSWindowDelegate>
 {
@@ -125,14 +115,10 @@
 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
 	//}
 #endif
-	/* Live resize ugly patch. Needed because live resize runs in a modal loop, not letting main loop run
+	/* Live resize, send event, gets handled in wm_window.c. Needed because live resize runs in a modal loop, not letting main loop run */
 	 if ([[notification object] inLiveResize]) {
 		systemCocoa->dispatchEvents();
-		wm_window_timer(ghostC);
-		wm_event_do_handlers(ghostC);
-		wm_event_do_notifiers(ghostC);
-		wm_draw_update(ghostC);
-	}*/
+	}
 }
 
 - (void)windowDidChangeBackingProperties:(NSNotification *)notification

Modified: trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp	2013-05-25 13:34:21 UTC (rev 57017)
+++ trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp	2013-05-25 14:08:56 UTC (rev 57018)
@@ -887,7 +887,7 @@
 					}
 					else {
 						m_multisampleEnabled = GHOST_kSuccess;
-						printf("Multisample failed to initialized\n");
+						printf("Multisample failed to initialize\n");
 						success = GHOST_kSuccess;
 					}
 				}

Modified: trunk/blender/source/blender/editors/screen/screen_edit.c
===================================================================
--- trunk/blender/source/blender/editors/screen/screen_edit.c	2013-05-25 13:34:21 UTC (rev 57017)
+++ trunk/blender/source/blender/editors/screen/screen_edit.c	2013-05-25 14:08:56 UTC (rev 57018)
@@ -664,15 +664,15 @@
 			 * need some way to store these as floats internally and re-apply from there. */
 			tempf = ((float)sv->vec.x) * facx;
 			sv->vec.x = (short)(tempf + 0.5f);
-			sv->vec.x += AREAGRID - 1;
-			sv->vec.x -=  (sv->vec.x % AREAGRID);
+			//sv->vec.x += AREAGRID - 1;
+			//sv->vec.x -=  (sv->vec.x % AREAGRID);
 
 			CLAMP(sv->vec.x, 0, winsizex);
 			
 			tempf = ((float)sv->vec.y) * facy;
 			sv->vec.y = (short)(tempf + 0.5f);
-			sv->vec.y += AREAGRID - 1;
-			sv->vec.y -=  (sv->vec.y % AREAGRID);
+			//sv->vec.y += AREAGRID - 1;
+			//sv->vec.y -=  (sv->vec.y % AREAGRID);
 
 			CLAMP(sv->vec.y, 0, winsizey);
 		}

Modified: trunk/blender/source/blender/windowmanager/intern/wm_window.c
===================================================================
--- trunk/blender/source/blender/windowmanager/intern/wm_window.c	2013-05-25 13:34:21 UTC (rev 57017)
+++ trunk/blender/source/blender/windowmanager/intern/wm_window.c	2013-05-25 14:08:56 UTC (rev 57018)
@@ -900,6 +900,13 @@
 						wm_draw_window_clear(win);
 						WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
 						WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
+						
+#if defined(__APPLE__)
+						/* OSX doesn't return to the mainloop while resize */
+						wm_event_do_handlers(C);
+						wm_event_do_notifiers(C);
+						wm_draw_update(C);
+#endif
 					}
 				}
 				break;




More information about the Bf-blender-cvs mailing list