* add fullscreen toggle operator (for testing fullscreen states in win32). hotkey is FKEY. Do test on other platforms, too.

This commit is contained in:
Nathan Letwory
2008-01-01 09:07:02 +00:00
parent 2d3bbe480c
commit bcb14c2a0f
4 changed files with 28 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ static void wm_window_keymap(wmWindowManager *wm)
/* note, this doesn't replace existing keymap items */ /* 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_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_save_homefile", UKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(&wm->windowkeymap, "WM_OT_window_fullscreen_toggle", FKEY, KM_PRESS, 0, 0);
} }
/* ****************************************** */ /* ****************************************** */

View File

@@ -100,6 +100,16 @@ static void WM_OT_save_homefile(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER; 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"); \ #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_window_duplicate);
ADD_OPTYPE(WM_OT_save_homefile); ADD_OPTYPE(WM_OT_save_homefile);
ADD_OPTYPE(WM_OT_window_fullscreen_toggle);
} }

View File

@@ -159,6 +159,19 @@ int wm_window_duplicate_op(bContext *C, wmOperator *op)
return 1; 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 */ /* this is event from ghost */
static void wm_window_close(bContext *C, wmWindow *win) 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); state = GHOST_GetWindowState(win->ghostwin);
/*if(state==GHOST_kWindowStateNormal) if(state==GHOST_kWindowStateNormal)
printf("window state: normal\n"); printf("window state: normal\n");
else if(state==GHOST_kWindowStateMinimized) else if(state==GHOST_kWindowStateMinimized)
printf("window state: minimized\n"); printf("window state: minimized\n");
else if(state==GHOST_kWindowStateMaximized) else if(state==GHOST_kWindowStateMaximized)
printf("window state: maximized\n"); printf("window state: maximized\n");
else if(state==GHOST_kWindowStateFullScreen) else if(state==GHOST_kWindowStateFullScreen)
printf("window state: fullscreen\n");*/ printf("window state: fullscreen\n");
// window_handle(win, RESHAPE, 1); // window_handle(win, RESHAPE, 1);
break; break;

View File

@@ -53,6 +53,7 @@ wmWindow *wm_window_copy (bContext *C, wmWindow *winorig);
/* *************** window operators ************** */ /* *************** window operators ************** */
int wm_window_duplicate_op (bContext *C, wmOperator *op); int wm_window_duplicate_op (bContext *C, wmOperator *op);
int wm_window_fullscreen_toggle_op(bContext *C, wmOperator *op);
#endif /* WM_WINDOW_H */ #endif /* WM_WINDOW_H */