WM: command line args to start blender maximized
authorCampbell Barton <ideasman42@gmail.com>
Mon, 11 Feb 2019 03:46:25 +0000 (14:46 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 11 Feb 2019 03:46:25 +0000 (14:46 +1100)
Part of D4323 by @DragMZ

source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_window.c
source/creator/creator_args.c

index 227f109..4eeed66 100644 (file)
@@ -81,6 +81,7 @@ const char *WM_init_state_app_template_get(void);
 void           WM_init_state_size_set          (int stax, int stay, int sizx, int sizy);
 void           WM_init_state_fullscreen_set(void);
 void           WM_init_state_normal_set(void);
+void           WM_init_state_maximized_set(void);
 void           WM_init_window_focus_set(bool do_it);
 void           WM_init_native_pixels(bool do_it);
 void           WM_init_tablet_api(void);
index 1cfb5ee..f79e8f5 100644 (file)
@@ -1972,6 +1972,12 @@ void WM_init_state_normal_set(void)
        wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
 }
 
+void WM_init_state_maximized_set(void)
+{
+       wm_init_state.windowstate = GHOST_kWindowStateMaximized;
+       wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
+}
+
 void WM_init_window_focus_set(bool do_it)
 {
        wm_init_state.window_focus = do_it;
index 3c06989..470bb47 100644 (file)
@@ -496,6 +496,7 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo
        BLI_argsPrintArgDoc(ba, "--window-border");
        BLI_argsPrintArgDoc(ba, "--window-fullscreen");
        BLI_argsPrintArgDoc(ba, "--window-geometry");
+       BLI_argsPrintArgDoc(ba, "--window-maximized");
        BLI_argsPrintArgDoc(ba, "--start-console");
        BLI_argsPrintArgDoc(ba, "--no-native-pixels");
        BLI_argsPrintArgDoc(ba, "--no-window-focus");
@@ -1140,6 +1141,15 @@ static int arg_handle_without_borders(int UNUSED(argc), const char **UNUSED(argv
        return 0;
 }
 
+static const char arg_handle_window_maximized_doc[] =
+"\n\tForce opening maximized."
+;
+static int arg_handle_window_maximized(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
+{
+       WM_init_state_maximized_set();
+       return 0;
+}
+
 static const char arg_handle_no_window_focus_doc[] =
 "\n\tOpen behind other windows and without taking focus."
 ;
@@ -1970,6 +1980,7 @@ void main_args_setup(bContext *C, bArgs *ba)
        BLI_argsAdd(ba, 2, "-p", "--window-geometry", CB(arg_handle_window_geometry), NULL);
        BLI_argsAdd(ba, 2, "-w", "--window-border", CB(arg_handle_with_borders), NULL);
        BLI_argsAdd(ba, 2, "-W", "--window-fullscreen", CB(arg_handle_without_borders), NULL);
+       BLI_argsAdd(ba, 2, "-M", "--window-maximized", CB(arg_handle_window_maximized), NULL);
        BLI_argsAdd(ba, 2, NULL, "--no-window-focus", CB(arg_handle_no_window_focus), NULL);
        BLI_argsAdd(ba, 2, "-con", "--start-console", CB(arg_handle_start_with_console), NULL);
        BLI_argsAdd(ba, 2, "-R", NULL, CB(arg_handle_register_extension), NULL);