Core: add --no-window-frame command line option
Add a command line option to load Blender without a window frame. Currently this is only used on Wayland, enabled for WITH_UI_TESTS since attempting to load LIBDECOR caused the tests to crash on start on Fedora. For tests there is no need to use LIBDECOR, so disable the window frame. This can also be used by users who don't want to use the X11 fallback if LIBDECOR can't be found. Ref !147716
This commit is contained in:
@@ -103,6 +103,8 @@ void WM_init_state_normal_set();
|
||||
void WM_init_state_maximized_set();
|
||||
void WM_init_state_start_with_console_set(bool value);
|
||||
void WM_init_window_focus_set(bool do_it);
|
||||
bool WM_init_window_frame_get();
|
||||
void WM_init_window_frame_set(bool do_it);
|
||||
void WM_init_native_pixels(bool do_it);
|
||||
void WM_init_input_devices();
|
||||
|
||||
|
||||
@@ -1862,6 +1862,7 @@ static std::optional<int> wm_main_playanim_intern(int argc, const char **argv, P
|
||||
|
||||
/* Init GHOST and open window. */
|
||||
GHOST_SetBacktraceHandler((GHOST_TBacktraceFn)BLI_system_backtrace);
|
||||
GHOST_UseWindowFrame(WM_init_window_frame_get());
|
||||
|
||||
ps.ghost_data.system = GHOST_CreateSystem();
|
||||
if (UNLIKELY(ps.ghost_data.system == nullptr)) {
|
||||
|
||||
@@ -132,6 +132,7 @@ static struct WMInitStruct {
|
||||
GHOST_TWindowState windowstate = GHOST_WINDOW_STATE_DEFAULT;
|
||||
eWinOverrideFlag override_flag;
|
||||
|
||||
bool window_frame = true;
|
||||
bool window_focus = true;
|
||||
bool native_pixels = true;
|
||||
} wm_init_state;
|
||||
@@ -2116,6 +2117,7 @@ void wm_ghost_init(bContext *C)
|
||||
consumer = GHOST_CreateEventConsumer(ghost_event_proc, C);
|
||||
|
||||
GHOST_SetBacktraceHandler((GHOST_TBacktraceFn)BLI_system_backtrace);
|
||||
GHOST_UseWindowFrame(wm_init_state.window_frame);
|
||||
|
||||
g_system = GHOST_CreateSystem();
|
||||
GPU_backend_ghost_system_set(g_system);
|
||||
@@ -2814,6 +2816,16 @@ void WM_init_state_maximized_set()
|
||||
wm_init_state.override_flag |= WIN_OVERRIDE_WINSTATE;
|
||||
}
|
||||
|
||||
bool WM_init_window_frame_get()
|
||||
{
|
||||
return wm_init_state.window_frame;
|
||||
}
|
||||
|
||||
void WM_init_window_frame_set(bool do_it)
|
||||
{
|
||||
wm_init_state.window_frame = do_it;
|
||||
}
|
||||
|
||||
void WM_init_window_focus_set(bool do_it)
|
||||
{
|
||||
wm_init_state.window_focus = do_it;
|
||||
|
||||
@@ -702,6 +702,7 @@ static void print_help(bArgs *ba, bool all)
|
||||
BLI_args_print_arg_doc(ba, "--window-geometry");
|
||||
BLI_args_print_arg_doc(ba, "--start-console");
|
||||
BLI_args_print_arg_doc(ba, "--no-native-pixels");
|
||||
BLI_args_print_arg_doc(ba, "--no-window-frame");
|
||||
BLI_args_print_arg_doc(ba, "--no-window-focus");
|
||||
|
||||
PRINT("\n");
|
||||
@@ -1889,6 +1890,15 @@ static int arg_handle_window_maximized(int /*argc*/, const char ** /*argv*/, voi
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char arg_handle_no_window_frame_doc[] =
|
||||
"\n\t"
|
||||
"Disable all window decorations (Wayland only).";
|
||||
static int arg_handle_no_window_frame(int /*argc*/, const char ** /*argv*/, void * /*data*/)
|
||||
{
|
||||
WM_init_window_frame_set(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char arg_handle_no_window_focus_doc[] =
|
||||
"\n\t"
|
||||
"Open behind other windows and without taking focus.";
|
||||
@@ -3087,6 +3097,7 @@ void main_args_setup(bContext *C, bArgs *ba, bool all)
|
||||
BLI_args_add(ba, "-w", "--window-border", CB(arg_handle_window_border), nullptr);
|
||||
BLI_args_add(ba, "-W", "--window-fullscreen", CB(arg_handle_window_fullscreen), nullptr);
|
||||
BLI_args_add(ba, "-M", "--window-maximized", CB(arg_handle_window_maximized), nullptr);
|
||||
BLI_args_add(ba, nullptr, "--no-window-frame", CB(arg_handle_no_window_frame), nullptr);
|
||||
BLI_args_add(ba, nullptr, "--no-window-focus", CB(arg_handle_no_window_focus), nullptr);
|
||||
BLI_args_add(ba, "-con", "--start-console", CB(arg_handle_start_with_console), nullptr);
|
||||
BLI_args_add(ba, "-r", "--register", CB(arg_handle_register_extension), nullptr);
|
||||
|
||||
Reference in New Issue
Block a user