* add fullscreen toggle operator (for testing fullscreen states in win32). hotkey...
authorNathan Letwory <nathan@letworyinteractive.com>
Tue, 1 Jan 2008 09:07:02 +0000 (09:07 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Tue, 1 Jan 2008 09:07:02 +0000 (09:07 +0000)
source/blender/windowmanager/intern/wm.c
source/blender/windowmanager/intern/wm_operators.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm_window.h

index 1576f4b..d62b24e 100644 (file)
@@ -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);
 }
 
 /* ****************************************** */
index d3216d2..a6992f5 100644 (file)
@@ -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);
 }
 
 
index 07efa13..9ac8010 100644 (file)
@@ -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;
index 3565bce..63fc068 100644 (file)
@@ -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 */