diff options
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_draw.c | 8 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 29 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 38 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_gesture.c | 28 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_init_exit.c | 6 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 163 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_subwindow.c | 3 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_window.c | 86 |
10 files changed, 225 insertions, 142 deletions
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 148932fa941..1b0870194a6 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -205,7 +205,7 @@ void WM_keymap_init(bContext *C) /* create default key config */ wm_window_keymap(wm->defaultconf); ED_spacetypes_keymap(wm->defaultconf); - WM_keyconfig_userdef(wm); + WM_keyconfig_userdef(); wm->initialized |= WM_INIT_KEYMAP; } diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 81417e8f8f1..9123cdeef20 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -127,7 +127,7 @@ static void wm_method_draw_full(bContext *C, wmWindow *win) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); } } @@ -242,7 +242,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); if(exchange) @@ -253,7 +253,7 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange) CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); wm_paintcursor_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); ar->swap= WIN_BOTH_OK; @@ -592,7 +592,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win) if(ar->swinid && ar->do_draw) { CTX_wm_region_set(C, ar); ED_region_do_draw(C, ar); - ED_area_overdraw_flush(C, sa, ar); + ED_area_overdraw_flush(sa, ar); CTX_wm_region_set(C, NULL); copytex= 1; } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 590d28012f9..47ca4314cc7 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1452,11 +1452,24 @@ static int wm_handlers_do(bContext *C, wmEvent *event, ListBase *handlers) wmWindow *win = CTX_wm_window(C); if (win && win->eventstate->prevtype == event->type && win->eventstate->prevval == KM_PRESS) { - /* test for double click first */ - if ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) { + /* test for double click first, + * note1: this can be problematic because single click operators can get the + * double click event but then with old mouse coords which is highly confusing, + * so check for mouse moves too. + * note2: the first click event will be handled but still used to create a + * double click event if clicking again quickly. + * If no double click events are found itwill fallback to a single click. + * So a double click event can result in 2 successive single click calls + * if its not handled by the keymap - campbell */ + if ( (ABS(event->x - win->eventstate->prevclickx)) <= 2 && + (ABS(event->y - win->eventstate->prevclicky)) <= 2 && + ((PIL_check_seconds_timer() - win->eventstate->prevclicktime) * 1000 < U.dbl_click_time) + ) { event->val = KM_DBL_CLICK; - event->x = win->eventstate->prevclickx; - event->y = win->eventstate->prevclicky; + /* removed this because in cases where we're this is used as a single click + * event, this will give old coords, since the distance is checked above, using new coords should be ok. */ + // event->x = win->eventstate->prevclickx; + // event->y = win->eventstate->prevclicky; action |= wm_handlers_do(C, event, handlers); } @@ -1894,7 +1907,7 @@ wmEventHandler *WM_event_add_keymap_handler(ListBase *handlers, wmKeyMap *keymap } /* priorities not implemented yet, for time being just insert in begin of list */ -wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int priority) +wmEventHandler *WM_event_add_keymap_handler_priority(ListBase *handlers, wmKeyMap *keymap, int UNUSED(priority)) { wmEventHandler *handler; @@ -2067,7 +2080,7 @@ static int convert_key(GHOST_TKey key) case GHOST_kKeyRightShift: return RIGHTSHIFTKEY; case GHOST_kKeyLeftControl: return LEFTCTRLKEY; case GHOST_kKeyRightControl: return RIGHTCTRLKEY; - case GHOST_kKeyCommand: return COMMANDKEY; + case GHOST_kKeyOS: return OSKEY; case GHOST_kKeyLeftAlt: return LEFTALTKEY; case GHOST_kKeyRightAlt: return RIGHTALTKEY; @@ -2167,7 +2180,7 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi /* windows store own event queues, no bContext here */ /* time is in 1000s of seconds, from ghost */ -void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int time, void *customdata) +void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int UNUSED(time), void *customdata) { wmWindow *owin; wmEvent event, *evt= win->eventstate; @@ -2324,7 +2337,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int t if(event.val==KM_PRESS && (evt->ctrl || evt->shift || evt->oskey)) event.alt= evt->alt = 3; // define? } - else if (event.type==COMMANDKEY) { + else if (event.type==OSKEY) { event.oskey= evt->oskey= (event.val==KM_PRESS); if(event.val==KM_PRESS && (evt->ctrl || evt->alt || evt->shift)) event.oskey= evt->oskey = 3; // define? diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 2888cf9b8d0..50d6c885022 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -259,8 +259,7 @@ static void wm_init_userdef(bContext *C) /* set the python auto-execute setting from user prefs */ /* disabled by default, unless explicitly enabled in the command line */ if ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) G.f |= G_SCRIPT_AUTOEXEC; - - if(U.tempdir[0]) strncpy(btempdir, U.tempdir, FILE_MAXDIR+FILE_MAXFILE); + if(U.tempdir[0]) BLI_where_is_temp(btempdir, 1); } void WM_read_file(bContext *C, char *name, ReportList *reports) @@ -284,7 +283,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) /* also exit screens and editors */ wm_window_match_init(C, &wmbase); - retval= BKE_read_file(C, name, NULL, reports); + retval= BKE_read_file(C, name, reports); G.save_over = 1; /* this flag is initialized by the operator but overwritten on read. @@ -336,13 +335,10 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) /* called on startup, (context entirely filled with NULLs) */ /* or called for 'New File' */ /* op can be NULL */ -/* note: G.sce is used to store the last saved path so backup and restore after loading - * G.main->name is similar to G.sce but when loading from memory set the name to startup.blend - * ...this could be changed but seems better then setting to "" */ int WM_read_homefile(bContext *C, wmOperator *op) { ListBase wmbase; - char tstr[FILE_MAXDIR+FILE_MAXFILE], scestr[FILE_MAXDIR]; + char tstr[FILE_MAXDIR+FILE_MAXFILE]; int from_memory= op && strcmp(op->type->idname, "WM_OT_read_factory_settings")==0; int success; @@ -352,7 +348,7 @@ int WM_read_homefile(bContext *C, wmOperator *op) if (!from_memory) { char *cfgdir = BLI_get_folder(BLENDER_USER_CONFIG, NULL); if (cfgdir) { - BLI_make_file_string(G.sce, tstr, cfgdir, BLENDER_STARTUP_FILE); + BLI_make_file_string(G.main->name, tstr, cfgdir, BLENDER_STARTUP_FILE); } else { tstr[0] = '\0'; from_memory = 1; @@ -361,7 +357,6 @@ int WM_read_homefile(bContext *C, wmOperator *op) } } } - strcpy(scestr, G.sce); /* temporary store */ /* prevent loading no UI */ G.fileflags &= ~G_FILE_NO_UI; @@ -370,9 +365,9 @@ int WM_read_homefile(bContext *C, wmOperator *op) wm_window_match_init(C, &wmbase); if (!from_memory && BLI_exists(tstr)) { - success = BKE_read_file(C, tstr, NULL, NULL); + success = BKE_read_file(C, tstr, NULL); } else { - success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL, NULL); + success = BKE_read_file_from_memory(C, datatoc_startup_blend, datatoc_startup_blend_size, NULL); if (wmbase.first == NULL) wm_clear_default_size(C); } @@ -384,7 +379,6 @@ int WM_read_homefile(bContext *C, wmOperator *op) wm_window_match_do(C, &wmbase); WM_check(C); /* opens window(s), checks keymaps */ - strcpy(G.sce, scestr); /* restore */ G.main->name[0]= '\0'; wm_init_userdef(C); @@ -441,9 +435,6 @@ void read_history(void) for (l= lines, num= 0; l && (num<U.recent_files); l= l->next) { line = l->link; if (line[0] && BLI_exists(line)) { - if (num==0) - strcpy(G.sce, line); /* note: this seems highly dodgy since the file isnt actually read. please explain. - campbell */ - recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile"); BLI_addtail(&(G.recent_files), recent); recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(line)+1), "name of file"); @@ -469,14 +460,14 @@ static void write_history(void) recent = G.recent_files.first; /* refresh recent-files.txt of recent opened files, when current file was changed */ - if(!(recent) || (strcmp(recent->filepath, G.sce)!=0)) { + if(!(recent) || (strcmp(recent->filepath, G.main->name)!=0)) { fp= fopen(name, "w"); if (fp) { /* add current file to the beginning of list */ recent = (RecentFile*)MEM_mallocN(sizeof(RecentFile),"RecentFile"); - recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.sce)+1), "name of file"); + recent->filepath = (char*)MEM_mallocN(sizeof(char)*(strlen(G.main->name)+1), "name of file"); recent->filepath[0] = '\0'; - strcpy(recent->filepath, G.sce); + strcpy(recent->filepath, G.main->name); BLI_addhead(&(G.recent_files), recent); /* write current file to recent-files.txt */ fprintf(fp, "%s\n", recent->filepath); @@ -485,7 +476,7 @@ static void write_history(void) /* write rest of recent opened files to recent-files.txt */ while((i<U.recent_files) && (recent)){ /* this prevents to have duplicities in list */ - if (strcmp(recent->filepath, G.sce)!=0) { + if (strcmp(recent->filepath, G.main->name)!=0) { fprintf(fp, "%s\n", recent->filepath); recent = recent->next; } @@ -527,7 +518,7 @@ static void do_history(char *name, ReportList *reports) BKE_report(reports, RPT_ERROR, "Unable to make version backup"); } -static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt) +static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt) { /* will be scaled down, but gives some nice oversampling */ ImBuf *ibuf; @@ -573,7 +564,7 @@ static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt) int write_crash_blend(void) { char path[FILE_MAX]; - BLI_strncpy(path, G.sce, sizeof(path)); + BLI_strncpy(path, G.main->name, sizeof(path)); BLI_replace_extension(path, sizeof(path), "_crash.blend"); if(BLO_write_file(G.main, path, G.fileflags, NULL, NULL)) { printf("written: %s\n", path); @@ -628,14 +619,13 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re ED_paint_force_update(C); /* blend file thumbnail */ - ibuf_thumb= blend_file_thumb(di, CTX_data_scene(C), &thumb); + ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); /* rename to .blend1, do this as last before write */ do_history(di, reports); if (BLO_write_file(CTX_data_main(C), di, fileflags, reports, thumb)) { if(!copy) { - strcpy(G.sce, di); G.relbase_valid = 1; strcpy(G.main->name, di); /* is guaranteed current file */ @@ -736,7 +726,7 @@ void WM_autosave_init(wmWindowManager *wm) wm->autosavetimer= WM_event_add_timer(wm, NULL, TIMERAUTOSAVE, U.savetime*60.0); } -void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *wt) +void wm_autosave_timer(const bContext *C, wmWindowManager *wm, wmTimer *UNUSED(wt)) { wmWindow *win; wmEventHandler *handler; diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index e87d2d79c39..8dcf65886e4 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -121,7 +121,7 @@ void WM_gestures_remove(bContext *C) /* tweak and line gestures */ #define TWEAK_THRESHOLD 10 -int wm_gesture_evaluate(bContext *C, wmGesture *gesture) +int wm_gesture_evaluate(wmGesture *gesture) { if(gesture->type==WM_GESTURE_TWEAK) { rcti *rect= gesture->customdata; @@ -159,7 +159,7 @@ int wm_gesture_evaluate(bContext *C, wmGesture *gesture) /* ******************* gesture draw ******************* */ -static void wm_gesture_draw_rect(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_rect(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -183,7 +183,7 @@ static void wm_gesture_draw_rect(wmWindow *win, wmGesture *gt) glDisable(GL_LINE_STIPPLE); } -static void wm_gesture_draw_line(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_line(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -199,7 +199,7 @@ static void wm_gesture_draw_line(wmWindow *win, wmGesture *gt) } -static void wm_gesture_draw_circle(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_circle(wmGesture *gt) { rcti *rect= (rcti *)gt->customdata; @@ -244,7 +244,7 @@ static void draw_filled_lasso(wmGesture *gt) /* highly unlikely this will fail, but could crash if (gt->points == 0) */ if(firstv) { BLI_addfilledge(firstv, v); - BLI_edgefill(0, 0); + BLI_edgefill(0); glEnable(GL_BLEND); glColor4f(1.0, 1.0, 1.0, 0.05); @@ -261,7 +261,7 @@ static void draw_filled_lasso(wmGesture *gt) } } -static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt) +static void wm_gesture_draw_lasso(wmGesture *gt) { short *lasso= (short *)gt->customdata; int i; @@ -320,23 +320,23 @@ void wm_gesture_draw(wmWindow *win) wmSubWindowSet(win, gt->swinid); if(gt->type==WM_GESTURE_RECT) - wm_gesture_draw_rect(win, gt); + wm_gesture_draw_rect(gt); else if(gt->type==WM_GESTURE_TWEAK) - wm_gesture_draw_line(win, gt); + wm_gesture_draw_line(gt); else if(gt->type==WM_GESTURE_CIRCLE) - wm_gesture_draw_circle(win, gt); + wm_gesture_draw_circle(gt); else if(gt->type==WM_GESTURE_CROSS_RECT) { if(gt->mode==1) - wm_gesture_draw_rect(win, gt); + wm_gesture_draw_rect(gt); else wm_gesture_draw_cross(win, gt); } else if(gt->type==WM_GESTURE_LINES) - wm_gesture_draw_lasso(win, gt); + wm_gesture_draw_lasso(gt); else if(gt->type==WM_GESTURE_LASSO) - wm_gesture_draw_lasso(win, gt); + wm_gesture_draw_lasso(gt); else if(gt->type==WM_GESTURE_STRAIGHTLINE) - wm_gesture_draw_line(win, gt); + wm_gesture_draw_line(gt); } } @@ -351,5 +351,3 @@ void wm_gesture_tag_redraw(bContext *C) wm_tag_redraw_overlay(win, ar); } - - diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 983361f01ff..b319058ce5c 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -167,10 +167,10 @@ void WM_init(bContext *C, int argc, char **argv) read_history(); - if(G.sce[0] == 0) - BLI_make_file_string("/", G.sce, BLI_getDefaultDocumentFolder(), "untitled.blend"); + if(G.main->name[0] == 0) + BLI_make_file_string("/", G.main->name, BLI_getDefaultDocumentFolder(), "untitled.blend"); - BLI_strncpy(G.lib, G.sce, FILE_MAX); + BLI_strncpy(G.lib, G.main->name, FILE_MAX); } diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index f1873b14232..436494be975 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -118,7 +118,7 @@ void WM_keyconfig_free(wmKeyConfig *keyconf) MEM_freeN(keyconf); } -void WM_keyconfig_userdef(wmWindowManager *wm) +void WM_keyconfig_userdef(void) { wmKeyMap *km; wmKeyMapItem *kmi; @@ -419,7 +419,7 @@ char *WM_keymap_item_to_string(wmKeyMapItem *kmi, char *str, int len) return str; } -static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int opcontext, IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) +static wmKeyMapItem *wm_keymap_item_find_handlers(const bContext *C, ListBase *handlers, const char *opname, int UNUSED(opcontext), IDProperty *properties, int compare_props, int hotkey, wmKeyMap **keymap_r) { wmWindowManager *wm= CTX_wm_manager(C); wmEventHandler *handler; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 121d2d3d21a..ef0572d3a12 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -31,7 +31,10 @@ #include <ctype.h> #include <stdio.h> #include <stddef.h> - +#ifdef WIN32 +#include <windows.h> +#include <io.h> +#endif #include "DNA_ID.h" #include "DNA_object_types.h" @@ -619,7 +622,7 @@ void WM_operator_properties_free(PointerRNA *ptr) /* ************ default op callbacks, exported *********** */ /* invoke callback, uses enum property named "type" */ -int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +int WM_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { PropertyRNA *prop= op->type->prop; uiPopupMenu *pup; @@ -724,7 +727,7 @@ static uiBlock *wm_enum_search_menu(bContext *C, ARegion *ar, void *arg_op) } -int WM_enum_search_invoke(bContext *C, wmOperator *op, wmEvent *event) +int WM_enum_search_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { uiPupBlock(C, wm_enum_search_menu, op); return OPERATOR_CANCELLED; @@ -751,13 +754,13 @@ int WM_operator_confirm_message(bContext *C, wmOperator *op, char *message) } -int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_confirm(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { return WM_operator_confirm_message(C, op, NULL); } /* op->invoke, opens fileselect if path property not set, otherwise executes */ -int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_filesel(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if (RNA_property_is_set(op->ptr, "filepath")) { return WM_operator_call(C, op); @@ -862,7 +865,7 @@ int WM_operator_winactive(bContext *C) } /* op->invoke */ -static void redo_cb(bContext *C, void *arg_op, int event) +static void redo_cb(bContext *C, void *arg_op, int UNUSED(event)) { wmOperator *lastop= arg_op; @@ -903,7 +906,7 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, &ptr, columns); + uiDefAutoButsRNA(layout, &ptr, columns); uiPopupBoundsBlock(block, 4.0f, 0, 0); uiEndBlock(C, block); @@ -922,7 +925,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) uiPupBlockClose(C, block); } -void dialog_check_cb(bContext *C, void *op_ptr, void *dummy2) +void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) { wmOperator *op= op_ptr; if(op->type->check) { @@ -966,7 +969,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, &ptr, columns); + uiDefAutoButsRNA(layout, &ptr, columns); uiBlockSetFunc(block, NULL, NULL, NULL); @@ -1014,7 +1017,7 @@ static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData) return block; } -int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *event) +int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { int retval= OPERATOR_CANCELLED; @@ -1083,7 +1086,7 @@ static uiBlock *wm_block_create_menu(bContext *C, ARegion *ar, void *arg_op) op->layout= NULL; } else - uiDefAutoButsRNA(C, layout, op->ptr, 2); + uiDefAutoButsRNA(layout, op->ptr, 2); uiPopupBoundsBlock(block, 4.0f, 0, 0); uiEndBlock(C, block); @@ -1100,7 +1103,7 @@ static int wm_debug_menu_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_debug_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { RNA_int_set(op->ptr, "debugval", G.rt); @@ -1127,7 +1130,7 @@ static void WM_OT_debug_menu(wmOperatorType *ot) /* ***************** Splash Screen ************************* */ -static void wm_block_splash_close(bContext *C, void *arg_block, void *arg_unused) +static void wm_block_splash_close(bContext *C, void *arg_block, void *UNUSED(arg)) { uiPupBlockClose(C, arg_block); } @@ -1136,7 +1139,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse /* XXX: hack to refresh splash screen with updated prest menu name, * since popup blocks don't get regenerated like panels do */ -void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused) +void wm_block_splash_refreshmenu (bContext *UNUSED(C), void *UNUSED(arg_block), void *UNUSED(arg)) { /* ugh, causes crashes in other buttons, disabling for now until * a better fix @@ -1145,7 +1148,7 @@ void wm_block_splash_refreshmenu (bContext *C, void *arg_block, void *unused) */ } -static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unused) +static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(arg)) { uiBlock *block; uiBut *but; @@ -1153,7 +1156,6 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse uiStyle *style= U.uistyles.first; struct RecentFile *recent; int i; - Menu menu= {0}; MenuType *mt= WM_menutype_find("USERPREF_MT_splash", TRUE); char url[64]; @@ -1193,9 +1195,13 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse uiBlockSetEmboss(block, UI_EMBOSS); /* show the splash menu (containing interaction presets), using python */ if (mt) { + Menu menu= {0}; menu.layout= layout; menu.type= mt; mt->draw(C, &menu); + +// wmWindowManager *wm= CTX_wm_manager(C); +// uiItemM(layout, C, "USERPREF_MT_keyconfigs", U.keyconfigstr, 0); } uiBlockSetEmboss(block, UI_EMBOSSP); @@ -1228,7 +1234,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *arg_unuse return block; } -static int wm_splash_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_splash_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event)) { uiPupBlock(C, wm_block_create_splash, NULL); @@ -1247,7 +1253,7 @@ static void WM_OT_splash(wmOperatorType *ot) /* ***************** Search menu ************************* */ -static void operator_call_cb(struct bContext *C, void *arg1, void *arg2) +static void operator_call_cb(struct bContext *C, void *UNUSED(arg1), void *arg2) { wmOperatorType *ot= arg2; @@ -1255,7 +1261,7 @@ static void operator_call_cb(struct bContext *C, void *arg1, void *arg2) WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL); } -static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items) +static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), char *str, uiSearchItems *items) { wmOperatorType *ot = WM_operatortype_first(); @@ -1282,7 +1288,7 @@ static void operator_search_cb(const struct bContext *C, void *arg, char *str, u } } -static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op) +static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *UNUSED(arg_op)) { static char search[256]= ""; wmEvent event; @@ -1312,15 +1318,13 @@ static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op) return block; } -static int wm_search_menu_exec(bContext *C, wmOperator *op) +static int wm_search_menu_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { - return OPERATOR_FINISHED; } -static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - uiPupBlock(C, wm_block_search_menu, op); return OPERATOR_CANCELLED; @@ -1386,7 +1390,7 @@ static void WM_OT_window_duplicate(wmOperatorType *ot) ot->idname= "WM_OT_window_duplicate"; ot->description="Duplicate the current Blender window"; - ot->exec= wm_window_duplicate_op; + ot->exec= wm_window_duplicate_exec; ot->poll= wm_operator_winactive_normal; } @@ -1437,9 +1441,9 @@ static void open_set_use_scripts(wmOperator *op) RNA_boolean_set(op->ptr, "use_scripts", !(U.flag & USER_SCRIPT_AUTOEXEC_DISABLE)); } -static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { - RNA_string_set(op->ptr, "filepath", G.sce); + RNA_string_set(op->ptr, "filepath", G.main->name); open_set_load_ui(op); open_set_use_scripts(op); @@ -1493,7 +1497,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) /* **************** link/append *************** */ -static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_link_append_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { if(!RNA_property_is_set(op->ptr, "relative_path")) RNA_boolean_set(op->ptr, "relative_path", U.flag & USER_RELPATHS); @@ -1718,7 +1722,7 @@ static int wm_recover_auto_save_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char filename[FILE_MAX]; @@ -1766,13 +1770,13 @@ static void save_set_compress(wmOperator *op) } } -static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char name[FILE_MAX]; save_set_compress(op); - BLI_strncpy(name, G.sce, FILE_MAX); + BLI_strncpy(name, G.main->name, FILE_MAX); untitled(name); RNA_string_set(op->ptr, "filepath", name); @@ -1793,7 +1797,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) if(RNA_property_is_set(op->ptr, "filepath")) RNA_string_get(op->ptr, "filepath", path); else { - BLI_strncpy(path, G.sce, FILE_MAX); + BLI_strncpy(path, G.main->name, FILE_MAX); untitled(path); } @@ -1817,7 +1821,7 @@ static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op) } /* function used for WM_OT_save_mainfile too */ -static int blend_save_check(bContext *C, wmOperator *op) +static int blend_save_check(bContext *UNUSED(C), wmOperator *op) { char filepath[FILE_MAX]; RNA_string_get(op->ptr, "filepath", filepath); @@ -1847,7 +1851,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) /* *************** save file directly ******** */ -static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) +static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { char name[FILE_MAX]; int check_existing=1; @@ -1858,7 +1862,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *event) save_set_compress(op); - BLI_strncpy(name, G.sce, FILE_MAX); + BLI_strncpy(name, G.main->name, FILE_MAX); untitled(name); RNA_string_set(op->ptr, "filepath", name); @@ -1904,7 +1908,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *event) { if(!RNA_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; - BLI_strncpy(filepath, G.sce, sizeof(filepath)); + BLI_strncpy(filepath, G.main->name, sizeof(filepath)); BLI_replace_extension(filepath, sizeof(filepath), ".dae"); RNA_string_set(op->ptr, "filepath", filepath); } @@ -1982,7 +1986,7 @@ static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot) ot->idname= "WM_OT_window_fullscreen_toggle"; ot->description="Toggle the current window fullscreen"; - ot->exec= wm_window_fullscreen_toggle_op; + ot->exec= wm_window_fullscreen_toggle_exec; ot->poll= WM_operator_winactive; } @@ -1995,10 +1999,10 @@ static int wm_exit_blender_op(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static void WM_OT_exit_blender(wmOperatorType *ot) +static void WM_OT_quit_blender(wmOperatorType *ot) { - ot->name= "Exit Blender"; - ot->idname= "WM_OT_exit_blender"; + ot->name= "Quit Blender"; + ot->idname= "WM_OT_quit_blender"; ot->description= "Quit Blender"; ot->invoke= WM_operator_confirm; @@ -2006,6 +2010,60 @@ static void WM_OT_exit_blender(wmOperatorType *ot) ot->poll= WM_operator_winactive; } +/* *********************** */ +#ifdef WIN32 +static int console= 1; +void WM_toggle_console(bContext *C, short show) +{ + if(show) { + FILE *fp; + char fn[FILE_MAX]; + char tmp[FILE_MAXDIR]; + BLI_where_is_temp(tmp, 1); + BLI_make_file_string("/", fn, tmp, "blenderlog.txt"); + /* open the console */ + AllocConsole(); + + /* redirect stdin */ + fp= freopen(fn, "r", stdin); + SetStdHandle(STD_INPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdin))); + /* redirect stdout */ + fp= freopen(fn, "w", stdout); + SetStdHandle(STD_OUTPUT_HANDLE, (HANDLE)_get_osfhandle(_fileno(stdout))); + /* redirect stderr */ + fp= freopen(fn, "w", stderr); + SetStdHandle(STD_ERROR_HANDLE, (HANDLE)_get_osfhandle(_fileno(stderr))); + + console= 1; + } + else { + FreeConsole(); + console= 0; + } +} + +static int wm_toggle_console_op(bContext *C, wmOperator *op) +{ + if(console) { + WM_toggle_console(C, 0); + } + else { + WM_toggle_console(C, 1); + } + return OPERATOR_FINISHED; +} + +static void WM_OT_toggle_console(wmOperatorType *ot) +{ + ot->name= "Toggle System Console"; + ot->idname= "WM_OT_toggle_console"; + ot->description= "Toggle System Console"; + + ot->exec= wm_toggle_console_op; + ot->poll= WM_operator_winactive; +} +#endif + /* ************ default paint cursors, draw always around cursor *********** */ /* - returns handler to free @@ -2298,7 +2356,7 @@ static void tweak_gesture_modal(bContext *C, wmEvent *event) rect->xmax= event->x - sx; rect->ymax= event->y - sy; - if((val= wm_gesture_evaluate(C, gesture))) { + if((val= wm_gesture_evaluate(gesture))) { wmEvent event; event= *(window->eventstate); @@ -2391,7 +2449,7 @@ int WM_gesture_lines_invoke(bContext *C, wmOperator *op, wmEvent *event) } -static void gesture_lasso_apply(bContext *C, wmOperator *op, int event_type) +static void gesture_lasso_apply(bContext *C, wmOperator *op) { wmGesture *gesture= op->customdata; PointerRNA itemptr; @@ -2460,7 +2518,7 @@ int WM_gesture_lasso_modal(bContext *C, wmOperator *op, wmEvent *event) case MIDDLEMOUSE: case RIGHTMOUSE: if(event->val==KM_RELEASE) { /* key release */ - gesture_lasso_apply(C, op, event->type); + gesture_lasso_apply(C, op); return OPERATOR_FINISHED; } break; @@ -2853,11 +2911,11 @@ void WM_radial_control_string(wmOperator *op, char str[], int maxlen) float v = RNA_float_get(op->ptr, "new_value"); if(mode == WM_RADIALCONTROL_SIZE) - sprintf(str, "Size: %d", (int)v); + BLI_snprintf(str, maxlen, "Size: %d", (int)v); else if(mode == WM_RADIALCONTROL_STRENGTH) - sprintf(str, "Strength: %d", (int)v); + BLI_snprintf(str, maxlen, "Strength: %d", (int)v); else if(mode == WM_RADIALCONTROL_ANGLE) - sprintf(str, "Angle: %d", (int)(v * 180.0f/M_PI)); + BLI_snprintf(str, maxlen, "Angle: %d", (int)(v * 180.0f/M_PI)); } /** Important: this doesn't define an actual operator, it @@ -3024,7 +3082,7 @@ static void WM_OT_redraw_timer(wmOperatorType *ot) /* ************************** memory statistics for testing ***************** */ -static int memory_statistics_exec(bContext *C, wmOperator *op) +static int memory_statistics_exec(bContext *UNUSED(C), wmOperator *UNUSED(op)) { MEM_printmemlist_stats(); return OPERATOR_FINISHED; @@ -3065,7 +3123,7 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_read_factory_settings); WM_operatortype_append(WM_OT_save_homefile); WM_operatortype_append(WM_OT_window_fullscreen_toggle); - WM_operatortype_append(WM_OT_exit_blender); + WM_operatortype_append(WM_OT_quit_blender); WM_operatortype_append(WM_OT_open_mainfile); WM_operatortype_append(WM_OT_link_append); WM_operatortype_append(WM_OT_recover_last_session); @@ -3078,6 +3136,9 @@ void wm_operatortype_init(void) WM_operatortype_append(WM_OT_splash); WM_operatortype_append(WM_OT_search_menu); WM_operatortype_append(WM_OT_call_menu); +#ifdef WIN32 + WM_operatortype_append(WM_OT_toggle_console); +#endif #ifdef WITH_COLLADA /* XXX: move these */ @@ -3268,7 +3329,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "WM_OT_open_mainfile", OKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "WM_OT_save_mainfile", SKEY, KM_PRESS, KM_OSKEY, 0); WM_keymap_add_item(keymap, "WM_OT_save_as_mainfile", SKEY, KM_PRESS, KM_SHIFT|KM_OSKEY, 0); - WM_keymap_add_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_OSKEY, 0); + WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_OSKEY, 0); #endif WM_keymap_add_item(keymap, "WM_OT_read_homefile", NKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0); @@ -3288,7 +3349,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) RNA_boolean_set(kmi->ptr, "copy", 1); WM_keymap_verify_item(keymap, "WM_OT_window_fullscreen_toggle", F11KEY, KM_PRESS, KM_ALT, 0); - WM_keymap_add_item(keymap, "WM_OT_exit_blender", QKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "WM_OT_quit_blender", QKEY, KM_PRESS, KM_CTRL, 0); /* debug/testing */ WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT|KM_CTRL, 0); @@ -3349,7 +3410,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, ID *id, int local) +static EnumPropertyItem *rna_id_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), int *free, ID *id, int local) { EnumPropertyItem *item= NULL, item_tmp; int totitem= 0; diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c index 207b6cebfe6..271b32359f5 100644 --- a/source/blender/windowmanager/intern/wm_subwindow.c +++ b/source/blender/windowmanager/intern/wm_subwindow.c @@ -40,6 +40,7 @@ #include "BLI_blenlib.h" #include "BLI_math.h" +#include "BKE_utildefines.h" #include "BKE_context.h" #include "BKE_global.h" @@ -73,7 +74,7 @@ typedef struct wmSubWindow { /* ******************* open, free, set, get data ******************** */ /* not subwindow itself */ -static void wm_subwindow_free(wmSubWindow *swin) +static void wm_subwindow_free(wmSubWindow *UNUSED(swin)) { /* future fancy stuff */ } diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 328c3e80259..69a29092058 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -45,6 +45,7 @@ #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_global.h" +#include "BKE_main.h" #include "BKE_utildefines.h" #include "BIF_gl.h" @@ -68,6 +69,7 @@ GHOST_SystemHandle g_system= NULL; /* set by commandline */ static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, initialstate= GHOST_kWindowStateNormal; +static unsigned short useprefsize= 0; /* ******** win open & close ************ */ @@ -259,17 +261,15 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) else { /* this is set to 1 if you don't have startup.blend open */ - if(G.save_over) { - char *str= MEM_mallocN(strlen(G.sce) + 16, "title"); + if(G.save_over && G.main->name[0]) { + char str[sizeof(G.main->name) + 12]; if(wm->file_saved) - sprintf(str, "Blender [%s]", G.sce); + sprintf(str, "Blender [%s]", G.main->name); else - sprintf(str, "Blender* [%s]", G.sce); + sprintf(str, "Blender* [%s]", G.main->name); GHOST_SetTitle(win->ghostwin, str); - - MEM_freeN(str); } else GHOST_SetTitle(win->ghostwin, "Blender"); @@ -289,7 +289,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) } /* belongs to below */ -static void wm_window_add_ghostwindow(bContext *C, wmWindowManager *wm, char *title, wmWindow *win) +static void wm_window_add_ghostwindow(bContext *C, char *title, wmWindow *win) { GHOST_WindowHandle ghostwin; int scr_w, scr_h, posy; @@ -352,7 +352,10 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) wmKeyMap *keymap; wmWindow *win; - /* no commandline prefsize? then we set this */ + /* no commandline prefsize? then we set this. + * Note that these values will be used only + * when there is no startup.blend yet. + */ if (!prefsizx) { wm_get_screensize(&prefsizx, &prefsizy); @@ -372,18 +375,19 @@ void wm_window_add_ghostwindows(bContext* C, wmWindowManager *wm) for(win= wm->windows.first; win; win= win->next) { if(win->ghostwin==NULL) { - if(win->sizex==0) { + if(win->sizex==0 || useprefsize) { win->posx= prefstax; win->posy= prefstay; win->sizex= prefsizx; win->sizey= prefsizy; win->windowstate= initialstate; + useprefsize= 0; } - wm_window_add_ghostwindow(C, wm, "Blender", win); + wm_window_add_ghostwindow(C, "Blender", win); } /* happens after fileread */ if(win->eventstate==NULL) - win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state"); + win->eventstate= MEM_callocN(sizeof(wmEvent), "window event state"); /* add keymap handlers (1 handler for all keys in map!) */ keymap= WM_keymap_find(wm->defaultconf, "Window", 0, 0); @@ -488,7 +492,7 @@ void WM_window_open_temp(bContext *C, rcti *position, int type) /* ****************** Operators ****************** */ /* operator callback */ -int wm_window_duplicate_op(bContext *C, wmOperator *op) +int wm_window_duplicate_exec(bContext *C, wmOperator *UNUSED(op)) { wm_window_copy(C, CTX_wm_window(C)); WM_check(C); @@ -500,7 +504,7 @@ int wm_window_duplicate_op(bContext *C, wmOperator *op) /* fullscreen operator callback */ -int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op) +int wm_window_fullscreen_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { wmWindow *window= CTX_wm_window(C); GHOST_TWindowState state = GHOST_GetWindowState(window->ghostwin); @@ -516,22 +520,37 @@ int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op) /* ************ events *************** */ -static int query_qual(char qual) +typedef enum +{ + SHIFT = 's', + CONTROL = 'c', + ALT = 'a', + OS = 'C' +} modifierKeyType; + +/* check if specified modifier key type is pressed */ +static int query_qual(modifierKeyType qual) { GHOST_TModifierKeyMask left, right; int val= 0; - if (qual=='s') { - left= GHOST_kModifierKeyLeftShift; - right= GHOST_kModifierKeyRightShift; - } else if (qual=='c') { - left= GHOST_kModifierKeyLeftControl; - right= GHOST_kModifierKeyRightControl; - } else if (qual=='C') { - left= right= GHOST_kModifierKeyCommand; - } else { - left= GHOST_kModifierKeyLeftAlt; - right= GHOST_kModifierKeyRightAlt; + switch(qual) { + case SHIFT: + left= GHOST_kModifierKeyLeftShift; + right= GHOST_kModifierKeyRightShift; + break; + case CONTROL: + left= GHOST_kModifierKeyLeftControl; + right= GHOST_kModifierKeyRightControl; + break; + case OS: + left= right= GHOST_kModifierKeyOS; + break; + case ALT: + default: + left= GHOST_kModifierKeyLeftAlt; + right= GHOST_kModifierKeyRightAlt; + break; } GHOST_GetModifierKeyState(g_system, left, &val); @@ -600,20 +619,20 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) /* bad ghost support for modifier keys... so on activate we set the modifiers again */ kdata.ascii= 0; - if (win->eventstate->shift && !query_qual('s')) { + if (win->eventstate->shift && !query_qual(SHIFT)) { kdata.key= GHOST_kKeyLeftShift; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->ctrl && !query_qual('c')) { + if (win->eventstate->ctrl && !query_qual(CONTROL)) { kdata.key= GHOST_kKeyLeftControl; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->alt && !query_qual('a')) { + if (win->eventstate->alt && !query_qual(ALT)) { kdata.key= GHOST_kKeyLeftAlt; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } - if (win->eventstate->oskey && !query_qual('C')) { - kdata.key= GHOST_kKeyCommand; + if (win->eventstate->oskey && !query_qual(OS)) { + kdata.key= GHOST_kKeyOS; wm_event_add_ghostevent(wm, win, GHOST_kEventKeyUp, time, &kdata); } /* keymodifier zero, it hangs on hotkeys that open windows otherwise */ @@ -875,7 +894,7 @@ void wm_window_process_events(const bContext *C) PIL_sleep_ms(5); } -void wm_window_process_events_nosleep(const bContext *C) +void wm_window_process_events_nosleep(void) { if(GHOST_ProcessEvents(g_system, 0)) GHOST_DispatchEvents(g_system); @@ -923,7 +942,7 @@ void wm_ghost_exit(void) /* **************** timer ********************** */ /* to (de)activate running timers temporary */ -void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *win, wmTimer *timer, int dosleep) +void WM_event_timer_sleep(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer, int dosleep) { wmTimer *wt; @@ -951,7 +970,7 @@ wmTimer *WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, return wt; } -void WM_event_remove_timer(wmWindowManager *wm, wmWindow *win, wmTimer *timer) +void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer) { wmTimer *wt; @@ -1109,6 +1128,7 @@ void WM_setprefsize(int stax, int stay, int sizx, int sizy) prefstay= stay; prefsizx= sizx; prefsizy= sizy; + useprefsize= 1; } /* for borderless and border windows set from command-line */ |