From ad0bf55843f8c025132b2f86569e87b31673d1ac Mon Sep 17 00:00:00 2001 From: Rob Haarsma Date: Thu, 8 May 2003 16:24:58 +0000 Subject: added a fullscreen button in the top header (windows only) written by Florian Eggenberger. --- source/blender/src/editscreen.c | 24 ++++++++++++++++-------- source/blender/src/ghostwinlay.c | 15 ++++++++++++++- source/blender/src/headerbuttons.c | 24 +++++++++++++++++++++++- source/blender/src/toets.c | 17 +++++++++++++++++ source/blender/src/usiblender.c | 16 +++++++++++++++- source/blender/src/winlay.h | 4 ++++ 6 files changed, 89 insertions(+), 11 deletions(-) (limited to 'source/blender/src') diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c index 60bf34a04f8..fd89b8400ac 100644 --- a/source/blender/src/editscreen.c +++ b/source/blender/src/editscreen.c @@ -118,7 +118,7 @@ static void wait_for_event(void); /* ********* Globals *********** */ static Window *mainwin= NULL; -static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, start_maximized= 1, start_fullscreen = 0; +static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0, start_maximized= 1; static short dodrawscreen= 0; static ScrArea *areawinar[MAXWIN]; static ScrArea *g_activearea= NULL; @@ -1111,6 +1111,15 @@ void screenmain(void) } } +#ifdef _WIN32 // FULLSCREEN +void mainwindow_toggle_fullscreen(int fullscreen){ + if (fullscreen) U.uiflag |= FLIPFULLSCREEN; + else U.uiflag &= ~FLIPFULLSCREEN; + + window_toggle_fullscreen(mainwin, fullscreen); +} +#endif + void mainwindow_raise(void) { window_raise(mainwin); } @@ -1124,11 +1133,6 @@ void mainwindow_close(void) { /* ********* AREAS ************* */ -void setfullscreen() -{ - start_fullscreen = 1; -} - void setprefsize(int stax, int stay, int sizx, int sizy) { int scrwidth, scrheight; @@ -1680,10 +1684,14 @@ static bScreen *addscreen(char *name) /* use setprefsize() if you want somethin sc->scene= G.scene; if (!mainwin) { - if (start_fullscreen) - mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, 2); +#ifdef _WIN32 // FULLSCREEN + if (G.windowstate == G_WINDOWSTATE_FULLSCREEN) + mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, G_WINDOWSTATE_FULLSCREEN); else mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, start_maximized); +#else + mainwin= window_open("Blender", sc->startx, sc->starty, sc->sizex, sc->sizey, start_maximized); +#endif if (!mainwin) { printf("ERROR: Unable to open Blender window\n"); diff --git a/source/blender/src/ghostwinlay.c b/source/blender/src/ghostwinlay.c index 73cb6cb9f40..0345f77cf28 100644 --- a/source/blender/src/ghostwinlay.c +++ b/source/blender/src/ghostwinlay.c @@ -234,10 +234,14 @@ Window *window_open(char *title, int posx, int posy, int sizex, int sizey, int s inital_state= start_maximized? GHOST_kWindowStateFullScreen:GHOST_kWindowStateNormal; #else - if (start_maximized == 2) +#ifdef _WIN32 // FULLSCREEN + if (start_maximized == G_WINDOWSTATE_FULLSCREEN) inital_state= GHOST_kWindowStateFullScreen; else inital_state= start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal; +#else + inital_state= start_maximized?GHOST_kWindowStateMaximized:GHOST_kWindowStateNormal; +#endif #endif ghostwin= GHOST_CreateWindow(g_system, @@ -568,6 +572,15 @@ void window_raise(Window *win) { GHOST_SetWindowOrder(win->ghostwin, GHOST_kWindowOrderTop); } +#ifdef _WIN32 //FULLSCREEN +void window_toggle_fullscreen(Window *win, int fullscreen) { + if(fullscreen) + GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateFullScreen); + else + GHOST_SetWindowState(win->ghostwin, GHOST_kWindowStateMaximized); +} +#endif + void window_warp_pointer(Window *win, int x, int y) { y= win->size[1] - y - 1; GHOST_ClientToScreen(win->ghostwin, x, y, &x, &y); diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c index f6a47eb3023..f370a2cc834 100644 --- a/source/blender/src/headerbuttons.c +++ b/source/blender/src/headerbuttons.c @@ -1407,6 +1407,12 @@ void do_global_buttons(unsigned short event) scrarea_queue_headredraw(curarea); break; +#ifdef _WIN32 // FULLSCREEN + case B_FLIPFULLSCREEN: + mainwindow_toggle_fullscreen((U.uiflag & FLIPFULLSCREEN)); + break; +#endif + /* Fileselect windows for user preferences file paths */ case B_FONTDIRFILESEL: /* is button from space.c *info* */ @@ -3408,6 +3414,7 @@ void info_buttons(void) &(U.uiflag), 0, 0, 0, 0, "Hide pulldown menus");/* dir */ } xco+=XIC; + if(U.uiflag & FLIPINFOMENU) { } else { uiBlockSetEmboss(block, UI_EMBOSSP); @@ -3481,7 +3488,22 @@ void info_buttons(void) curarea->headbutlen= xco+2*XIC; if(curarea->headbutlen + 4*XIC < curarea->winx) { - uiDefIconBut(block, BUT, B_FILEMENU, ICON_HELP, (short)(curarea->winx-XIC-2), 0,XIC,YIC, 0, 0, 0, 0, 0, "Toolbox menu, hotkey: SPACE"); + uiDefIconBut(block, BUT, B_FILEMENU, ICON_HELP, + (short)(curarea->winx-XIC-2), 0,XIC,YIC, + 0, 0, 0, 0, 0, "Toolbox menu, hotkey: SPACE"); + +#ifdef _WIN32 // FULLSCREEN + if(U.uiflag & FLIPFULLSCREEN) { + uiDefIconButS(block, TOG|BIT|7, B_FLIPFULLSCREEN, ICON_SPLITSCREEN, + (short)(curarea->winx-(XIC*2)-2), 0,XIC,YIC, + &(U.uiflag), 0, 0, 0, 0, "Toggle Blender fullscreen");/* dir */ + } else { + uiDefIconButS(block, TOG|BIT|7, B_FLIPFULLSCREEN, ICON_FULLSCREEN, + (short)(curarea->winx-(XIC*2)-2), 0,XIC,YIC, + &(U.uiflag), 0, 0, 0, 0, "Toggle Blender fullscreen");/* dir */ + } +#endif + } uiDrawBlock(block); diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c index 91b1c39db7a..6394959dd0c 100644 --- a/source/blender/src/toets.c +++ b/source/blender/src/toets.c @@ -643,7 +643,15 @@ int blenderqread(unsigned short event, short val) case LEFTARROWKEY: case DOWNARROWKEY: if(textediting==0 && textspace==0) { + +#ifdef _WIN32 // FULLSCREEN + if(event==DOWNARROWKEY){ + if (G.qual & LR_ALTKEY) mainwindow_toggle_fullscreen(0); + else CFRA-= 10; + } +#else if(event==DOWNARROWKEY) CFRA-= 10; +#endif else CFRA--; if(G.qual & LR_SHIFTKEY) CFRA= SFRA; @@ -657,8 +665,17 @@ int blenderqread(unsigned short event, short val) case RIGHTARROWKEY: case UPARROWKEY: if(textediting==0 && textspace==0) { + +#ifdef _WIN32 // FULLSCREEN + if(event==UPARROWKEY){ + if(G.qual & LR_ALTKEY) mainwindow_toggle_fullscreen(1); + else CFRA+= 10; + } +#else if(event==UPARROWKEY) CFRA+= 10; +#endif else CFRA++; + if(G.qual & LR_SHIFTKEY) CFRA= EFRA; update_for_newframe(); diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 8f8d635905c..8b3254c346b 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -182,7 +182,21 @@ int BIF_read_homefile(void) /* disable autoplay in .B.blend... */ G.fileflags &= ~G_FILE_AUTOPLAY; - + +#ifdef _WIN32 // FULLSCREEN + /* choose window startmode */ + switch (G.windowstate){ + case G_WINDOWSTATE_USERDEF: /* use the usersetting */ + break; + case G_WINDOWSTATE_FULLSCREEN: /* force fullscreen */ + U.uiflag |= FLIPFULLSCREEN; + break; + case G_WINDOWSTATE_BORDER: /* force with borders */ + U.uiflag &= ~FLIPFULLSCREEN; + } + mainwindow_toggle_fullscreen ((U.uiflag & FLIPFULLSCREEN)); +#endif + if (BLI_streq(U.tempdir, "/")) { char *tmp= getenv("TEMP"); diff --git a/source/blender/src/winlay.h b/source/blender/src/winlay.h index fb2a2fcb89d..2f5cc3ce386 100644 --- a/source/blender/src/winlay.h +++ b/source/blender/src/winlay.h @@ -44,6 +44,10 @@ void window_set_timer (Window *win, int delay_ms, int event); void window_make_active (Window *win); void window_swap_buffers (Window *win); +#ifdef _WIN32 // FULLSCREEN +void window_toggle_fullscreen(Window *win, int fullscreen); +#endif + void window_raise (Window *win); void window_lower (Window *win); -- cgit v1.2.3