* add fullscreen toggle operator (for testing fullscreen states in win32). hotkey is FKEY. Do test on other platforms, too.
This commit is contained in:
@@ -74,6 +74,7 @@ static void wm_window_keymap(wmWindowManager *wm)
|
||||
/* note, this doesn't replace existing keymap items */
|
||||
WM_keymap_verify_item(&wm->windowkeymap, "WM_OT_window_duplicate", AKEY, KM_PRESS, 0, 0);
|
||||
WM_keymap_verify_item(&wm->windowkeymap, "WM_OT_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
|
||||
WM_keymap_verify_item(&wm->windowkeymap, "WM_OT_window_fullscreen_toggle", FKEY, KM_PRESS, 0, 0);
|
||||
}
|
||||
|
||||
/* ****************************************** */
|
||||
|
@@ -100,6 +100,16 @@ static void WM_OT_save_homefile(wmOperatorType *ot)
|
||||
ot->flag= OPTYPE_REGISTER;
|
||||
}
|
||||
|
||||
static void WM_OT_window_fullscreen_toggle(wmOperatorType *ot)
|
||||
{
|
||||
ot->name= "Toggle Fullscreen";
|
||||
ot->idname= "WM_OT_window_fullscreen_toggle";
|
||||
|
||||
ot->interactive= NULL;
|
||||
ot->exec= wm_window_fullscreen_toggle_op;
|
||||
ot->poll= WM_operator_winactive;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define ADD_OPTYPE(opfunc) ot= MEM_callocN(sizeof(wmOperatorType), "operatortype"); \
|
||||
@@ -120,6 +130,7 @@ void wm_operatortype_init(void)
|
||||
|
||||
ADD_OPTYPE(WM_OT_window_duplicate);
|
||||
ADD_OPTYPE(WM_OT_save_homefile);
|
||||
ADD_OPTYPE(WM_OT_window_fullscreen_toggle);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -159,6 +159,19 @@ int wm_window_duplicate_op(bContext *C, wmOperator *op)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* fullscreen operator callback */
|
||||
int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op)
|
||||
{
|
||||
GHOST_TWindowState state = GHOST_GetWindowState(C->window->ghostwin);
|
||||
if(state!=GHOST_kWindowStateFullScreen)
|
||||
GHOST_SetWindowState(C->window->ghostwin, GHOST_kWindowStateFullScreen);
|
||||
else
|
||||
GHOST_SetWindowState(C->window->ghostwin, GHOST_kWindowStateNormal);
|
||||
|
||||
return 1;
|
||||
|
||||
}
|
||||
|
||||
/* this is event from ghost */
|
||||
static void wm_window_close(bContext *C, wmWindow *win)
|
||||
{
|
||||
@@ -388,14 +401,14 @@ int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
|
||||
|
||||
state = GHOST_GetWindowState(win->ghostwin);
|
||||
|
||||
/*if(state==GHOST_kWindowStateNormal)
|
||||
if(state==GHOST_kWindowStateNormal)
|
||||
printf("window state: normal\n");
|
||||
else if(state==GHOST_kWindowStateMinimized)
|
||||
printf("window state: minimized\n");
|
||||
else if(state==GHOST_kWindowStateMaximized)
|
||||
printf("window state: maximized\n");
|
||||
else if(state==GHOST_kWindowStateFullScreen)
|
||||
printf("window state: fullscreen\n");*/
|
||||
printf("window state: fullscreen\n");
|
||||
|
||||
// window_handle(win, RESHAPE, 1);
|
||||
break;
|
||||
|
@@ -53,6 +53,7 @@ wmWindow *wm_window_copy (bContext *C, wmWindow *winorig);
|
||||
|
||||
/* *************** window operators ************** */
|
||||
int wm_window_duplicate_op (bContext *C, wmOperator *op);
|
||||
int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op);
|
||||
|
||||
|
||||
#endif /* WM_WINDOW_H */
|
||||
|
Reference in New Issue
Block a user