added a fullscreen button in the top header (windows only)

written by Florian Eggenberger.
This commit is contained in:
2003-05-08 16:24:58 +00:00
parent 97feb53f36
commit ad0bf55843
13 changed files with 112 additions and 12 deletions

View File

@@ -121,6 +121,9 @@ typedef struct Global {
/* this variable is written to / read from FileGlobal->fileflags */
int fileflags;
/* save the allowed windowstate of blender when using -W or -w */
int windowstate;
/* Janco's playing ground */
struct bSoundListener* listener;
@@ -189,6 +192,11 @@ typedef struct Global {
#define G_FILE_SIGN (1 << G_FILE_SIGN_BIT)
#define G_FILE_PUBLISH (1 << G_FILE_PUBLISH_BIT)
/* G.windowstate */
#define G_WINDOWSTATE_USERDEF 0
#define G_WINDOWSTATE_BORDER 1
#define G_WINDOWSTATE_FULLSCREEN 2
/* G.simulf */
#define G_LOADFILE 2
#define G_RESTART 4

View File

@@ -207,6 +207,10 @@ void initglobals(void)
sprintf(versionstr, "www.blender.org %d", G.version);
#ifdef _WIN32 // FULLSCREEN
G.windowstate = G_WINDOWSTATE_USERDEF;
#endif
clear_workob(); /* object.c */
}

View File

@@ -95,7 +95,6 @@ int is_allowed_to_change_screen(struct bScreen *newp);
void splash(void * data, int datasizei, char * string);
void screenmain(void);
void getdisplaysize(void);
void setfullscreen(void);
void setprefsize(int stax, int stay, int sizx, int sizy);
void calc_arearcts(struct ScrArea *sa);
void resize_screen(int x, int y, int w, int h);

View File

@@ -85,6 +85,10 @@ extern void winqreadseqspace(struct ScrArea *sa, void *spacedata, struct B
extern void test_butspace(void);
extern void start_game(void);
#ifdef _WIN32 // FULLSCREEN
extern void mainwindow_toggle_fullscreen(int fullscreen);
#endif
extern void mainwindow_raise(void);
extern void mainwindow_make_active(void);
extern void mainwindow_close(void);

View File

@@ -189,6 +189,7 @@
#define B_DRAWINFO 62
#define B_REDRCURW3D 63
#define B_FLIPINFOMENU 64
#define B_FLIPFULLSCREEN 65
#define B_SHOWSPLASH 70

View File

@@ -88,6 +88,7 @@ extern UserDef U; /* from usiblender.c !!!! */
#define DRAWVIEWINFO 16
#define EVTTOCONSOLE 32 //print ghost events, here for tuhopuu compat. --phase
#define FLIPINFOMENU 64
#define FLIPFULLSCREEN 128
/* transopts */

View File

@@ -574,6 +574,7 @@ int get_qtcodec_settings(void)
// cd.componentManufacturer = 0;
// cd.componentFlags = 0;
// cd.componentFlagsMask = 0;
Handle *theText;
if(qcdx == NULL) {
qcdx = MEM_callocN(sizeof(QuicktimeCodecDataExt), "QuicktimeCodecDataExt");
@@ -629,6 +630,10 @@ int get_qtcodec_settings(void)
SCGetInfo(qcdx->theComponent, scSpatialSettingsType, &qcdx->gSpatialSettings);
SCGetInfo(qcdx->theComponent, scDataRateSettingsType, &qcdx->aDataRateSetting);
//GraphicsExportGetSettingsAsText (qcdx->theComponent,theText );
//printf("%s\n", theText);
// framerate jugglin'
if(qcdx->gTemporalSettings.frameRate == 1571553) { // 23.98 fps

View File

@@ -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");

View File

@@ -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);

View File

@@ -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);

View File

@@ -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();

View File

@@ -183,6 +183,20 @@ 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");

View File

@@ -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);