From 6da6c9922176cc9bf07b57ec5d70fd509a739fce Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 8 Nov 2012 11:31:15 +0000 Subject: Small fix: Pressing ESC for renders now checks for modifier keys, and doesn't escape renders when a modifier key is held. In Windows, SHIFT+CTRL+ESC brings up task manager, and it seems to pass on the event. --- source/blender/windowmanager/intern/wm_event_system.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 7cfa3ce9396..236ab264f8c 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2978,9 +2978,10 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U if (event.keymodifier == UNKNOWNKEY) event.keymodifier = 0; - /* if test_break set, it catches this. XXX Keep global for now? */ - if (event.type == ESCKEY && event.val == KM_PRESS) - G.is_break = TRUE; + /* if test_break set, it catches this. Do not set with modifier presses. XXX Keep global for now? */ + if (event.type == ESCKEY && event.val == KM_PRESS && + event.shift == 0 && event.ctrl == 0 && event.alt == 0) + G.is_break = TRUE; /* double click test - only for press */ if (event.val == KM_PRESS) { -- cgit v1.2.3 From eff734203ff7a0f4a4f97015c9f1f59632c75abf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 9 Nov 2012 08:28:14 +0000 Subject: add fallbacks for BM_vert_calc_shell_factor() and BM_vert_calc_mean_tagged_edge_length() to avoid divide by zero when a vertex has no connected geometry. also style cleanup. --- source/blender/windowmanager/intern/wm_event_system.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 236ab264f8c..14244de00f6 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2979,9 +2979,12 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U event.keymodifier = 0; /* if test_break set, it catches this. Do not set with modifier presses. XXX Keep global for now? */ - if (event.type == ESCKEY && event.val == KM_PRESS && - event.shift == 0 && event.ctrl == 0 && event.alt == 0) - G.is_break = TRUE; + if ((event.type == ESCKEY && event.val == KM_PRESS) && + /* check other modifiers because ms-windows uses these to bring up the task manager */ + (event.shift == 0 && event.ctrl == 0 && event.alt == 0)) + { + G.is_break = TRUE; + } /* double click test - only for press */ if (event.val == KM_PRESS) { -- cgit v1.2.3 From 6d31921b2608ba743f290bf90aabd3e6fb110c50 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Fri, 9 Nov 2012 10:41:47 +0000 Subject: Temporarily change: Intel graphics cards now use Triple Buffer when you set it to "Auto". Recent tests proved that this is now working... and better test this now well than a week before a release! --- source/blender/windowmanager/intern/wm_draw.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index d7285ec4380..60e3f7d6164 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -711,12 +711,14 @@ static int wm_automatic_draw_method(wmWindow *win) if (GPU_type_matches(GPU_DEVICE_ATI, GPU_OS_UNIX, GPU_DRIVER_OPENSOURCE)) return USER_DRAW_OVERLAP; /* also Intel drivers are slow */ + /* 2.64 BCon3 period, let's try if intel now works... else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_UNIX, GPU_DRIVER_ANY)) return USER_DRAW_OVERLAP; else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_ANY)) return USER_DRAW_OVERLAP_FLIP; else if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_MAC, GPU_DRIVER_ANY)) return USER_DRAW_OVERLAP_FLIP; + */ /* Windows software driver darkens color on each redraw */ else if (GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE)) return USER_DRAW_OVERLAP_FLIP; -- cgit v1.2.3 From 4121e4b7e7420bfafe218da501162c8eae22a158 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 10 Nov 2012 11:55:45 +0000 Subject: Added UI support to set OpenGL MultiSample. Code to support it was lying around for long already, but not controlled by UI nicely. Now you have in user preferences "System" tab an option to set it. NOTE: - it only works saving as User startup.blend, and restart Blender. - your system should support it, no check for it is visible in UI - tested only on iMac OSX 10.7 Screenshot: http://www.blender.org/bf/chinchilla.blend.png --- source/blender/windowmanager/intern/wm_window.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 616567e8184..87d80402af6 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -345,7 +345,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) (GHOST_TWindowState)win->windowstate, GHOST_kDrawingContextTypeOpenGL, 0 /* no stereo */, - 0 /* no AA */); + U.ogl_multisamples /* AA */); if (ghostwin) { /* needed so we can detect the graphics card below */ @@ -373,7 +373,6 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) /* standard state vars for window */ glEnable(GL_SCISSOR_TEST); - GPU_state_init(); } } -- cgit v1.2.3 From c4f332084f202123b73b9623c892997c005ba948 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 11 Nov 2012 10:55:32 +0000 Subject: code cleanup: - blf doesnt have includes for TRUE/FALSE, use 1/0. - rename ogl_multisamples -> multi_sample, also shorten enum strings. --- source/blender/windowmanager/intern/wm_window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 87d80402af6..631bd0c9002 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -345,7 +345,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) (GHOST_TWindowState)win->windowstate, GHOST_kDrawingContextTypeOpenGL, 0 /* no stereo */, - U.ogl_multisamples /* AA */); + U.ogl_multisamples /* AA */); if (ghostwin) { /* needed so we can detect the graphics card below */ -- cgit v1.2.3 From 886dcf617e573862c45db8dc77316adcb6db0b05 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 11 Nov 2012 12:02:39 +0000 Subject: MultiSample feature: added provision that requires a restart in order to get it work properly - you cannot set/disable it in a running program with windows open. In short: Multisample setting is static, set on first time running of Blender, after reading the user preferences. For as far as I can see - disabling/enableing (glEnable) doesn't harm to be used in drawing code. With multisample on at start, you can enable and disable it freely. But without it set at start, enabling doesn't do anything nor draws badly. --- source/blender/windowmanager/intern/wm_window.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 631bd0c9002..97052fd2fc6 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -333,8 +333,14 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) static void wm_window_add_ghostwindow(const char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; + static int multisamples = -1; int scr_w, scr_h, posy; + /* force setting multisamples only once, it requires restart - and you cannot + mix it, either all windows have it, or none (tested in OSX opengl) */ + if (multisamples == -1) + multisamples = U.ogl_multisamples; + wm_get_screensize(&scr_w, &scr_h); posy = (scr_h - win->posy - win->sizey); @@ -345,7 +351,7 @@ static void wm_window_add_ghostwindow(const char *title, wmWindow *win) (GHOST_TWindowState)win->windowstate, GHOST_kDrawingContextTypeOpenGL, 0 /* no stereo */, - U.ogl_multisamples /* AA */); + multisamples /* AA */); if (ghostwin) { /* needed so we can detect the graphics card below */ -- cgit v1.2.3 From 7d583e37bb8c9e96477f77f5981e55dbfad4b6aa Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 11 Nov 2012 13:12:53 +0000 Subject: Bugfix, IRC report: NumPad emulation code wasn't working for double-clicks, preventing to fast type same values in buttons (Like, 111111 resulted in 111 only). Moved the emulation hack to where it belongs, in lowest level function that interprets the ghost events for Blender's WM events. --- .../blender/windowmanager/intern/wm_event_system.c | 143 +++++++++++---------- 1 file changed, 73 insertions(+), 70 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 14244de00f6..54e61df4f6a 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1279,74 +1279,6 @@ int WM_userdef_event_map(int kmitype) return kmitype; } -static void wm_eventemulation(wmEvent *event) -{ - /* Store last mmb event value to make emulation work when modifier keys are released first. */ - static int mmb_emulated = 0; /* this should be in a data structure somwhere */ - - /* middlemouse emulation */ - if (U.flag & USER_TWOBUTTONMOUSE) { - if (event->type == LEFTMOUSE) { - - if (event->val == KM_PRESS && event->alt) { - event->type = MIDDLEMOUSE; - event->alt = 0; - mmb_emulated = 1; - } - else if (event->val == KM_RELEASE) { - /* only send middle-mouse release if emulated */ - if (mmb_emulated) { - event->type = MIDDLEMOUSE; - event->alt = 0; - } - mmb_emulated = 0; - } - } - - } - -#ifdef __APPLE__ - - /* rightmouse emulation */ - if (U.flag & USER_TWOBUTTONMOUSE) { - if (event->type == LEFTMOUSE) { - - if (event->val == KM_PRESS && event->oskey) { - event->type = RIGHTMOUSE; - event->oskey = 0; - mmb_emulated = 1; - } - else if (event->val == KM_RELEASE) { - if (mmb_emulated) { - event->oskey = RIGHTMOUSE; - event->alt = 0; - } - mmb_emulated = 0; - } - } - - } -#endif - - /* numpad emulation */ - if (U.flag & USER_NONUMPAD) { - switch (event->type) { - case ZEROKEY: event->type = PAD0; break; - case ONEKEY: event->type = PAD1; break; - case TWOKEY: event->type = PAD2; break; - case THREEKEY: event->type = PAD3; break; - case FOURKEY: event->type = PAD4; break; - case FIVEKEY: event->type = PAD5; break; - case SIXKEY: event->type = PAD6; break; - case SEVENKEY: event->type = PAD7; break; - case EIGHTKEY: event->type = PAD8; break; - case NINEKEY: event->type = PAD9; break; - case MINUSKEY: event->type = PADMINUS; break; - case EQUALKEY: event->type = PADPLUSKEY; break; - case BACKSLASHKEY: event->type = PADSLASHKEY; break; - } - } -} static int wm_eventmatch(wmEvent *winevent, wmKeyMapItem *kmi) { @@ -2113,8 +2045,6 @@ void wm_event_do_handlers(bContext *C) } #endif - wm_eventemulation(event); - CTX_wm_window_set(C, win); /* we let modal handlers get active area/region, also wm_paintcursor_test needs it */ @@ -2616,6 +2546,75 @@ static int convert_key(GHOST_TKey key) } } +static void wm_eventemulation(wmEvent *event) +{ + /* Store last mmb event value to make emulation work when modifier keys are released first. */ + static int mmb_emulated = 0; /* this should be in a data structure somwhere */ + + /* middlemouse emulation */ + if (U.flag & USER_TWOBUTTONMOUSE) { + if (event->type == LEFTMOUSE) { + + if (event->val == KM_PRESS && event->alt) { + event->type = MIDDLEMOUSE; + event->alt = 0; + mmb_emulated = 1; + } + else if (event->val == KM_RELEASE) { + /* only send middle-mouse release if emulated */ + if (mmb_emulated) { + event->type = MIDDLEMOUSE; + event->alt = 0; + } + mmb_emulated = 0; + } + } + + } + +#ifdef __APPLE__ + + /* rightmouse emulation */ + if (U.flag & USER_TWOBUTTONMOUSE) { + if (event->type == LEFTMOUSE) { + + if (event->val == KM_PRESS && event->oskey) { + event->type = RIGHTMOUSE; + event->oskey = 0; + mmb_emulated = 1; + } + else if (event->val == KM_RELEASE) { + if (mmb_emulated) { + event->oskey = RIGHTMOUSE; + event->alt = 0; + } + mmb_emulated = 0; + } + } + + } +#endif + + /* numpad emulation */ + if (U.flag & USER_NONUMPAD) { + switch (event->type) { + case ZEROKEY: event->type = PAD0; break; + case ONEKEY: event->type = PAD1; break; + case TWOKEY: event->type = PAD2; break; + case THREEKEY: event->type = PAD3; break; + case FOURKEY: event->type = PAD4; break; + case FIVEKEY: event->type = PAD5; break; + case SIXKEY: event->type = PAD6; break; + case SEVENKEY: event->type = PAD7; break; + case EIGHTKEY: event->type = PAD8; break; + case NINEKEY: event->type = PAD9; break; + case MINUSKEY: event->type = PADMINUS; break; + case EQUALKEY: event->type = PADPLUSKEY; break; + case BACKSLASHKEY: event->type = PADSLASHKEY; break; + } + } +} + /* adds customdata to event */ static void update_tablet_data(wmWindow *win, wmEvent *event) { @@ -2825,6 +2824,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U else event.type = MIDDLEMOUSE; + wm_eventemulation(&event); + /* copy previous state to prev event state (two old!) */ evt->prevval = evt->val; evt->prevtype = evt->type; @@ -2890,6 +2891,8 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U memcpy(event.utf8_buf, kd->utf8_buf, sizeof(event.utf8_buf)); /* might be not null terminated*/ event.val = (type == GHOST_kEventKeyDown) ? KM_PRESS : KM_RELEASE; + wm_eventemulation(&event); + /* copy previous state to prev event state (two old!) */ evt->prevval = evt->val; evt->prevtype = evt->type; -- cgit v1.2.3 From 731e15be069d0d4231a93c3eb48b936f3b36179b Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sun, 11 Nov 2012 18:33:35 +0000 Subject: Four fixes (own collection) - Screencast: stops working on window resize - crashes movie file output - Screencast now draws simple brush overlay to indicate mouse cursor. - Greasepencil now works again to use MMB for view rotates (and missed proper redraw signal for toolbar, at end of paint) --- source/blender/windowmanager/intern/wm_window.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 97052fd2fc6..a965cbf82d6 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -754,6 +754,11 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr state = GHOST_GetWindowState(win->ghostwin); win->windowstate = state; + /* stop screencast if resize */ + if (type == GHOST_kEventWindowSize) { + WM_jobs_stop(CTX_wm_manager(C), win->screen, NULL); + } + /* win32: gives undefined window size when minimized */ if (state != GHOST_kWindowStateMinimized) { GHOST_RectangleHandle client_rect; -- cgit v1.2.3