Blender V5.3
wm_window.cc File Reference
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <thread>
#include <fmt/format.h>
#include "CLG_log.h"
#include "DNA_listBase.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
#include "DNA_workspace_types.h"
#include "MEM_guardedalloc.h"
#include "GHOST_CallbackEventConsumer.hh"
#include "GHOST_IContext.hh"
#include "GHOST_IEvent.hh"
#include "GHOST_ISystem.hh"
#include "GHOST_IWindow.hh"
#include "GHOST_Types.hh"
#include "BLI_enum_flags.hh"
#include "BLI_fileops.hh"
#include "BLI_listbase.hh"
#include "BLI_math_vector_c.hh"
#include "BLI_path_utils.hh"
#include "BLI_rect.hh"
#include "BLI_string.hh"
#include "BLI_string_utf8.hh"
#include "BLI_system.hh"
#include "BLI_time.hh"
#include "BLT_translation.hh"
#include "BKE_autoexec.hh"
#include "BKE_blender_version.h"
#include "BKE_context.hh"
#include "BKE_global.hh"
#include "BKE_icons.hh"
#include "BKE_layer.hh"
#include "BKE_main.hh"
#include "BKE_recents.hh"
#include "BKE_report.hh"
#include "BKE_screen.hh"
#include "BKE_wm_runtime.hh"
#include "BKE_workspace.hh"
#include "PRF_profile.hh"
#include "RNA_access.hh"
#include "RNA_enum_types.hh"
#include "WM_api.hh"
#include "WM_keymap.hh"
#include "WM_types.hh"
#include "wm.hh"
#include "wm_draw.hh"
#include "wm_event_system.hh"
#include "wm_files.hh"
#include "wm_window.hh"
#include "wm_window_private.hh"
#include "ED_anim_api.hh"
#include "ED_fileselect.hh"
#include "ED_render.hh"
#include "ED_scene.hh"
#include "ED_screen.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "UI_interface.hh"
#include "UI_interface_icons.hh"
#include "UI_interface_layout.hh"
#include "BLF_api.hh"
#include "GPU_capabilities.hh"
#include "GPU_context.hh"
#include "GPU_framebuffer.hh"
#include "GPU_init_exit.hh"
#include "UI_resources.hh"
#include "BLI_threads.hh"

Go to the source code of this file.

Classes

struct  blender::wmInitStruct

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define GHOST_WINDOW_STATE_DEFAULT   GHOST_kWindowStateMaximized

Enumerations

enum  blender::eWinOverrideFlag { blender::WIN_OVERRIDE_GEOM = (1 << 0) , blender::WIN_OVERRIDE_WINSTATE = (1 << 1) }

Functions

Window Size (public)
static void blender::wm_window_csd_title_redraw_tag (wmWindowManager *wm, wmWindow *win)
int blender::WM_window_native_pixel_x (const wmWindow *win)
int blender::WM_window_native_pixel_y (const wmWindow *win)
int2 blender::WM_window_native_pixel_size (const wmWindow *win)
void blender::WM_window_native_pixel_coords (const wmWindow *win, int *x, int *y)
bool blender::WM_window_csd_is_active ()
bool blender::WM_window_is_csd (const wmWindow *win)
void blender::WM_window_rect_calc (const wmWindow *win, rcti *r_rect)
void blender::WM_window_screen_rect_calc (const wmWindow *win, rcti *r_rect)
bool blender::WM_window_is_fullscreen (const wmWindow *win)
bool blender::WM_window_is_maximized (const wmWindow *win)
bool blender::WM_window_is_main_top_level (const wmWindow *win)
bool blender::WM_window_support_hdr_color (const wmWindow *win)
Window Open
static void blender::wm_window_set_drawable (wmWindowManager *wm, wmWindow *win, bool activate)
static bool blender::wm_window_timers_process (const bContext *C, int *sleep_us_p)
static uint8_t blender::wm_ghost_modifier_query (const enum ModSide side)
bool blender::wm_get_screensize (int r_size[2])
bool blender::wm_get_desktopsize (int r_size[2])
static void blender::wm_window_check_size (rcti *rect)
static void blender::wm_ghostwindow_destroy (wmWindowManager *wm, wmWindow *win)
void blender::wm_window_free (bContext *C, wmWindowManager *wm, wmWindow *win)
static int blender::find_free_winid (wmWindowManager *wm)
wmWindow * blender::wm_window_new (const Main *bmain, wmWindowManager *wm, wmWindow *parent, bool dialog)
wmWindow * blender::wm_window_copy (Main *bmain, wmWindowManager *wm, wmWindow *win_src, const bool duplicate_layout, const bool child)
wmWindow * blender::wm_window_copy_test (bContext *C, wmWindow *win_src, const bool duplicate_layout, const bool child)
Window Quit Confirmation Dialog
static void blender::wm_save_file_on_quit_dialog_callback (bContext *C, void *)
static void blender::wm_confirm_quit (bContext *C)
void blender::wm_quit_with_optional_confirmation_prompt (bContext *C, wmWindow *win)
Window Close
static bool blender::wm_window_is_last_main_window (wmWindowManager *wm, wmWindow *win)
void blender::wm_window_close_request (bContext *C, wmWindowManager *wm, wmWindow *win)
void blender::wm_window_close (bContext *C, wmWindowManager *wm, wmWindow *win)
static void blender::wm_window_title_project_append (fmt::memory_buffer &win_title)
static void blender::wm_window_title_text (wmWindowManager *wm, wmWindow *win, std::optional< FunctionRef< void(const char *)> > window_filepath_fn, fmt::memory_buffer &win_title)
static void blender::wm_window_title_state_refresh (wmWindowManager *wm, wmWindow *win)
void blender::WM_window_title_set (wmWindow *win, const char *title)
void blender::WM_window_title_refresh (wmWindowManager *wm, wmWindow *win)
void blender::WM_window_dpi_set_userdef (const wmWindow *win)
float blender::WM_window_dpi_get_scale (const wmWindow *win)
Window Decoration Style
eWM_WindowDecorationStyleFlag blender::WM_window_decoration_style_flags_get (const wmWindow *win)
void blender::WM_window_decoration_style_flags_set (const wmWindow *win, eWM_WindowDecorationStyleFlag style_flags)
void blender::wm_window_titlebar_theme_context_set (const wmWindow *win, const bScreen *screen)
static void blender::wm_window_decoration_style_set_from_theme (const wmWindow *win, const bScreen *screen)
void blender::WM_window_decoration_style_apply (const wmWindow *win, const bScreen *screen)
static void blender::wm_window_update_eventstate_modifiers (wmWindowManager *wm, wmWindow *win, const uint64_t event_time_ms)
static void blender::wm_window_update_eventstate_modifiers_clear (wmWindowManager *wm, wmWindow *win, const uint64_t event_time_ms)
static void blender::wm_window_update_eventstate (wmWindow *win)
static void blender::wm_window_ensure_eventstate (wmWindow *win)
static bool blender::wm_window_update_size_position (wmWindow *win)
static void blender::wm_window_ghostwindow_add (wmWindowManager *wm, const char *title, wmWindow *win, bool is_dialog)
static void blender::wm_window_ghostwindow_ensure (wmWindowManager *wm, wmWindow *win, bool is_dialog)
void blender::wm_window_ghostwindows_ensure (wmWindowManager *wm)
void blender::wm_window_ghostwindows_remove_invalid (bContext *C, wmWindowManager *wm)
wmWindow * blender::WM_window_open (bContext *C, const char *title, const rcti *rect_unscaled, int space_type, bool toplevel, bool dialog, bool temp, eWindowAlignment alignment, void(*area_setup_fn)(bScreen *screen, ScrArea *area, void *user_data), void *area_setup_user_data)
wmWindow * blender::WM_window_open_temp (bContext *C, const char *title, int space_type, bool dialog)
Operators
wmOperatorStatus blender::wm_window_close_exec (bContext *C, wmOperator *)
wmOperatorStatus blender::wm_window_new_exec (bContext *C, wmOperator *op)
wmOperatorStatus blender::wm_window_new_main_exec (bContext *C, wmOperator *op)
wmOperatorStatus blender::wm_window_fullscreen_toggle_exec (bContext *C, wmOperator *)
Events
void blender::wm_cursor_position_from_ghost_client_coords (wmWindow *win, int *x, int *y)
void blender::wm_cursor_position_to_ghost_client_coords (wmWindow *win, int *x, int *y)
void blender::wm_cursor_position_from_ghost_screen_coords (wmWindow *win, int *x, int *y)
void blender::wm_cursor_position_to_ghost_screen_coords (wmWindow *win, int *x, int *y)
bool blender::wm_cursor_position_get (wmWindow *win, int *r_x, int *r_y)
void blender::wm_window_clear_drawable (wmWindowManager *wm)
void blender::wm_window_make_drawable (wmWindowManager *wm, wmWindow *win)
void blender::wm_window_reset_drawable ()
static void blender::ghost_event_proc_timestamp_warning (const GHOST_IEvent *ghost_event)
static bool blender::ghost_event_proc (const GHOST_IEvent *ghost_event, GHOST_TUserDataPtr C_void_ptr)
void blender::wm_window_events_process (const bContext *C)
Ghost Init/Exit
void blender::wm_ghost_init (bContext *C)
void blender::wm_ghost_init_background ()
void blender::wm_ghost_exit ()
const char * blender::WM_ghost_backend ()
GHOST_TDrawingContextType blender::wm_ghost_drawing_context_type (const GPUBackendType gpu_backend)
void blender::wm_test_gpu_backend_fallback (bContext *C)
eWM_CapabilitiesFlag blender::WM_capabilities_flag ()
Event Timer
void blender::WM_event_timer_sleep (wmWindowManager *wm, wmWindow *, wmTimer *timer, bool do_sleep)
wmTimer * blender::WM_event_timer_add (wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
wmTimer * blender::WM_event_timer_add_notifier (wmWindowManager *wm, wmWindow *win, const uint type, const double time_step)
void blender::wm_window_timers_delete_removed (wmWindowManager *wm)
void blender::WM_event_timer_free_data (wmTimer *timer)
void blender::WM_event_timer_remove (wmWindowManager *wm, wmWindow *, wmTimer *timer)
void blender::WM_event_timer_remove_notifier (wmWindowManager *wm, wmWindow *win, wmTimer *timer)
Clipboard
static char * blender::wm_clipboard_text_get_ex (bool selection, int *r_len, const bool ensure_utf8, const bool firstline)
char * blender::WM_clipboard_text_get (bool selection, bool ensure_utf8, int *r_len)
char * blender::WM_clipboard_text_get_firstline (bool selection, bool ensure_utf8, int *r_len)
void blender::WM_clipboard_text_set (const char *buf, bool selection)
bool blender::WM_clipboard_image_available ()
ImBuf * blender::WM_clipboard_image_get ()
bool blender::WM_clipboard_image_set_byte_buffer (ImBuf *ibuf)
Progress Bar
void blender::WM_progress_set (wmWindow *win, float progress)
void blender::WM_progress_clear (wmWindow *win)
Window Position/Size (internal)
void blender::wm_window_set_size (wmWindow *win, int width, int height)
Window Depth (Raise/Lower)
void blender::wm_window_lower (wmWindow *win)
void blender::wm_window_raise (wmWindow *win)
Window Buffers
void blender::wm_window_swap_buffer_acquire (wmWindow *win)
 Push rendered buffer to the screen.
void blender::wm_window_swap_buffer_release (wmWindow *win)
void blender::wm_window_set_swap_interval (wmWindow *win, int interval)
bool blender::wm_window_get_swap_interval (wmWindow *win, int *r_interval)
Find Window Utility
wmWindow * blender::WM_window_find_under_cursor (wmWindow *win, const int event_xy[2], int r_event_xy_other[2])
wmWindow * blender::WM_window_find_by_area (wmWindowManager *wm, const ScrArea *area)
Initial Window State API
void blender::WM_init_state_size_set (int stax, int stay, int sizx, int sizy)
void blender::WM_init_state_fullscreen_set ()
void blender::WM_init_state_normal_set ()
void blender::WM_init_state_maximized_set ()
bool blender::WM_init_window_frame_get ()
void blender::WM_init_window_frame_set (bool do_it)
void blender::WM_init_window_focus_set (bool do_it)
void blender::WM_init_native_pixels (bool do_it)
Cursor API
void blender::WM_init_input_devices ()
void blender::WM_cursor_warp (wmWindow *win, int x, int y)
uint blender::WM_cursor_preferred_logical_size (const bool hardware_cursor)
Window Screen/Scene/WorkSpaceViewLayer API
void blender::WM_windows_scene_data_sync (const ListBaseT< wmWindow > *win_lb, Scene *scene)
Scene * blender::WM_windows_scene_get_from_screen (const wmWindowManager *wm, const bScreen *screen)
ViewLayer * blender::WM_windows_view_layer_get_from_screen (const wmWindowManager *wm, const bScreen *screen)
WorkSpace * blender::WM_windows_workspace_get_from_screen (const wmWindowManager *wm, const bScreen *screen)
Scene * blender::WM_window_get_active_scene (const wmWindow *win)
void blender::WM_window_set_active_scene (Main *bmain, bContext *C, wmWindow *win, Scene *scene)
ViewLayer * blender::WM_window_get_active_view_layer (const wmWindow *win)
void blender::WM_window_set_active_view_layer (wmWindow *win, ViewLayer *view_layer)
void blender::WM_window_ensure_active_view_layer (wmWindow *win)
WorkSpace * blender::WM_window_get_active_workspace (const wmWindow *win)
void blender::WM_window_set_active_workspace (bContext *C, wmWindow *win, WorkSpace *workspace)
WorkSpaceLayout * blender::WM_window_get_active_layout (const wmWindow *win)
void blender::WM_window_set_active_layout (wmWindow *win, WorkSpace *workspace, WorkSpaceLayout *layout)
bScreen * blender::WM_window_get_active_screen (const wmWindow *win)
void blender::WM_window_set_active_screen (wmWindow *win, WorkSpace *workspace, bScreen *screen)
bool blender::WM_window_is_temp_screen (const wmWindow *win)
Direct GPU Context Management
GHOST_IContext * blender::WM_system_gpu_context_create ()
void blender::WM_system_gpu_context_dispose (GHOST_IContext *context)
void blender::WM_system_gpu_context_activate (GHOST_IContext *context)
void blender::WM_system_gpu_context_release (GHOST_IContext *context)
void blender::WM_ghost_show_message_box (const char *title, const char *message, const char *help_label, const char *continue_label, const char *link, GHOST_DialogOptions dialog_options)

Variables

static GHOST_ISystem * blender::g_system = nullptr
static const char * blender::g_system_backend_id = nullptr
static CLG_LogRef blender::LOG_GHOST_SYSTEM = {"ghost.system"}
static struct blender::wmInitStruct blender::wm_init_state

Modifier Constants

enum  blender::ModSide { blender::MOD_SIDE_LEFT = 0 , blender::MOD_SIDE_RIGHT = 1 }
static const struct  blender::g_modifier_table []

Clipboard Wrappers

GHOST function wrappers that support a "fake" clipboard used when simulating events. This is useful user actions can be simulated while the system is in use without the system's clipboard getting overwritten.

struct * blender::g_wm_clipboard_text_simulate = nullptr
void blender::wm_clipboard_free ()
static char * blender::wm_clipboard_text_get_impl (bool selection)
static void blender::wm_clipboard_text_set_impl (const char *buf, bool selection)

Detailed Description

Window management, wrap GHOST.

Definition in file wm_window.cc.

Macro Definition Documentation

◆ GHOST_WINDOW_STATE_DEFAULT

#define GHOST_WINDOW_STATE_DEFAULT   GHOST_kWindowStateMaximized

Definition at line 133 of file wm_window.cc.

Referenced by blender::wm_window_ghostwindow_ensure().