Blender V5.0
wm_window.hh File Reference

Go to the source code of this file.

Functions

void wm_ghost_init (bContext *C)
void wm_ghost_init_background ()
void wm_ghost_exit ()
void wm_clipboard_free ()
bool wm_get_screensize (int r_size[2]) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool wm_get_desktopsize (int r_size[2]) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
wmWindowwm_window_new (const Main *bmain, wmWindowManager *wm, wmWindow *parent, bool dialog)
wmWindowwm_window_copy (Main *bmain, wmWindowManager *wm, wmWindow *win_src, bool duplicate_layout, bool child)
wmWindowwm_window_copy_test (bContext *C, wmWindow *win_src, bool duplicate_layout, bool child)
void wm_window_free (bContext *C, wmWindowManager *wm, wmWindow *win)
void wm_window_close (bContext *C, wmWindowManager *wm, wmWindow *win)
void wm_window_ghostwindows_ensure (wmWindowManager *wm)
void wm_window_ghostwindows_remove_invalid (bContext *C, wmWindowManager *wm)
void wm_window_events_process (const bContext *C)
void wm_window_clear_drawable (wmWindowManager *wm)
void wm_window_make_drawable (wmWindowManager *wm, wmWindow *win)
void wm_window_reset_drawable ()
void wm_window_raise (wmWindow *win)
void wm_window_lower (wmWindow *win)
void wm_window_set_size (wmWindow *win, int width, int height)
void wm_window_swap_buffer_acquire (wmWindow *win)
 Push rendered buffer to the screen.
void wm_window_swap_buffer_release (wmWindow *win)
void wm_window_set_swap_interval (wmWindow *win, int interval)
bool wm_window_get_swap_interval (wmWindow *win, int *r_interval)
bool wm_cursor_position_get (wmWindow *win, int *r_x, int *r_y) ATTR_WARN_UNUSED_RESULT
void wm_cursor_position_from_ghost_screen_coords (wmWindow *win, int *x, int *y)
void wm_cursor_position_to_ghost_screen_coords (wmWindow *win, int *x, int *y)
void wm_cursor_position_from_ghost_client_coords (wmWindow *win, int *x, int *y)
void wm_cursor_position_to_ghost_client_coords (wmWindow *win, int *x, int *y)
void wm_window_timers_delete_removed (wmWindowManager *wm)
wmOperatorStatus wm_window_close_exec (bContext *C, wmOperator *op)
wmOperatorStatus wm_window_fullscreen_toggle_exec (bContext *C, wmOperator *op)
void wm_quit_with_optional_confirmation_prompt (bContext *C, wmWindow *win) ATTR_NONNULL()
wmOperatorStatus wm_window_new_exec (bContext *C, wmOperator *op)
wmOperatorStatus wm_window_new_main_exec (bContext *C, wmOperator *op)
void wm_test_autorun_revert_action_set (wmOperatorType *ot, PointerRNA *ptr)
void wm_test_autorun_warning (bContext *C)
void wm_test_foreign_file_warning (bContext *C)

Function Documentation

◆ wm_clipboard_free()

void wm_clipboard_free ( )

Definition at line 2455 of file wm_window.cc.

References ARRAY_SIZE, g_wm_clipboard_text_simulate, i, and MEM_freeN().

Referenced by WM_exit_ex().

◆ wm_cursor_position_from_ghost_client_coords()

void wm_cursor_position_from_ghost_client_coords ( wmWindow * win,
int * x,
int * y )

◆ wm_cursor_position_from_ghost_screen_coords()

void wm_cursor_position_from_ghost_screen_coords ( wmWindow * win,
int * x,
int * y )

◆ wm_cursor_position_get()

◆ wm_cursor_position_to_ghost_client_coords()

void wm_cursor_position_to_ghost_client_coords ( wmWindow * win,
int * x,
int * y )

◆ wm_cursor_position_to_ghost_screen_coords()

void wm_cursor_position_to_ghost_screen_coords ( wmWindow * win,
int * x,
int * y )

◆ wm_get_desktopsize()

bool wm_get_desktopsize ( int r_size[2])

Size of all screens (desktop), useful since the mouse is bound by this.

Returns
true on success.

Definition at line 192 of file wm_window.cc.

References g_system, GHOST_GetAllDisplayDimensions(), and GHOST_kFailure.

Referenced by wm_window_ghostwindow_add(), and wm_window_update_size_position().

◆ wm_get_screensize()

bool wm_get_screensize ( int r_size[2])

This one should correctly check for apple top header... done for Cocoa: returns window contents (and not frame) max size.

Returns
true on success.

Definition at line 181 of file wm_window.cc.

References g_system, GHOST_GetMainDisplayDimensions(), and GHOST_kFailure.

Referenced by wm_window_check_size(), and wm_window_ghostwindows_ensure().

◆ wm_ghost_exit()

void wm_ghost_exit ( )

Definition at line 2173 of file wm_window.cc.

References g_system, and GHOST_DisposeSystem().

Referenced by WM_exit_ex().

◆ wm_ghost_init()

◆ wm_ghost_init_background()

◆ wm_quit_with_optional_confirmation_prompt()

void wm_quit_with_optional_confirmation_prompt ( bContext * C,
wmWindow * win )

Call the quit confirmation prompt or exit directly if needed. The use can still cancel via the confirmation popup. Also, this may not quit Blender immediately, but rather schedule the closing.

Parameters
winThe window to show the confirmation popup/window in.

Definition at line 407 of file wm_window.cc.

References C, CTX_data_main(), CTX_wm_manager(), CTX_wm_window(), CTX_wm_window_set(), G, U, USER_SAVE_PROMPT, wm_confirm_quit(), wm_exit_schedule_delayed(), wm_file_or_session_data_has_unsaved_changes(), and wm_window_raise().

Referenced by ghost_event_proc(), wm_exit_blender_invoke(), and wm_window_close().

◆ wm_test_autorun_revert_action_set()

◆ wm_test_autorun_warning()

◆ wm_test_foreign_file_warning()

void wm_test_foreign_file_warning ( bContext * C)

◆ wm_window_clear_drawable()

◆ wm_window_close()

void wm_window_close ( bContext * C,
wmWindowManager * wm,
wmWindow * win )

◆ wm_window_close_exec()

wmOperatorStatus wm_window_close_exec ( bContext * C,
wmOperator * op )

Definition at line 1360 of file wm_window.cc.

References C, CTX_wm_manager(), CTX_wm_window(), OPERATOR_FINISHED, and wm_window_close().

Referenced by WM_OT_window_close().

◆ wm_window_copy()

◆ wm_window_copy_test()

wmWindow * wm_window_copy_test ( bContext * C,
wmWindow * win_src,
bool duplicate_layout,
bool child )

A higher level version of copy that tests the new window can be added. (called from the operator directly).

Definition at line 365 of file wm_window.cc.

References C, CTX_data_main(), CTX_wm_manager(), CTX_wm_window(), wmWindow::ghostwin, NA_ADDED, NC_WINDOW, WM_check(), WM_event_add_notifier_ex(), wm_window_close(), and wm_window_copy().

Referenced by wm_stereo3d_set_exec(), and wm_window_new_main_exec().

◆ wm_window_events_process()

◆ wm_window_free()

◆ wm_window_fullscreen_toggle_exec()

◆ wm_window_get_swap_interval()

bool wm_window_get_swap_interval ( wmWindow * win,
int * r_interval )

Definition at line 2734 of file wm_window.cc.

References GHOST_GetSwapInterval(), and wmWindow::ghostwin.

◆ wm_window_ghostwindows_ensure()

void wm_window_ghostwindows_ensure ( wmWindowManager * wm)

Initialize wmWindow without ghostwin, open these and clear.

Window size is read from window, if 0 it uses prefsize called in WM_check, also initialize stuff after file read.

Warning
After running, win->ghostwin can be NULL in rare cases (where OpenGL driver fails to create a context for eg). We could remove them with wm_window_ghostwindows_remove_invalid but better not since caller may continue to use. Instead, caller needs to handle the error case and cleanup.

Definition at line 1085 of file wm_window.cc.

References BLI_assert, G, LISTBASE_FOREACH, UNLIKELY, wmWindowManager::windows, wm_get_screensize(), wm_init_state, and wm_window_ghostwindow_ensure().

Referenced by WM_check().

◆ wm_window_ghostwindows_remove_invalid()

void wm_window_ghostwindows_remove_invalid ( bContext * C,
wmWindowManager * wm )

Call after wm_window_ghostwindows_ensure or WM_check (after loading a new file) in the unlikely event a window couldn't be created.

Definition at line 1110 of file wm_window.cc.

References BLI_assert, C, G, LISTBASE_FOREACH_MUTABLE, wmWindowManager::windows, and wm_window_close().

Referenced by wm_file_read_post().

◆ wm_window_lower()

void wm_window_lower ( wmWindow * win)

◆ wm_window_make_drawable()

◆ wm_window_new()

◆ wm_window_new_exec()

◆ wm_window_new_main_exec()

◆ wm_window_raise()

◆ wm_window_reset_drawable()

◆ wm_window_set_size()

void wm_window_set_size ( wmWindow * win,
int width,
int height )

Definition at line 2686 of file wm_window.cc.

References GHOST_SetClientSize(), and wmWindow::ghostwin.

Referenced by WM_window_open().

◆ wm_window_set_swap_interval()

void wm_window_set_swap_interval ( wmWindow * win,
int interval )

Definition at line 2729 of file wm_window.cc.

References GHOST_SetSwapInterval(), and wmWindow::ghostwin.

◆ wm_window_swap_buffer_acquire()

void wm_window_swap_buffer_acquire ( wmWindow * win)

Push rendered buffer to the screen.

Definition at line 2719 of file wm_window.cc.

References GHOST_SwapWindowBufferAcquire(), and wmWindow::ghostwin.

Referenced by wm_draw_update(), and wm_window_ghostwindow_add().

◆ wm_window_swap_buffer_release()

void wm_window_swap_buffer_release ( wmWindow * win)

◆ wm_window_timers_delete_removed()

void wm_window_timers_delete_removed ( wmWindowManager * wm)

Effectively remove timers from the list and delete them. Calling this should only be done by internal WM management code, from specific, safe places.

Definition at line 2386 of file wm_window.cc.

References BLI_remlink(), LISTBASE_FOREACH_MUTABLE, MEM_freeN(), wmWindowManager::runtime, and WM_TIMER_TAGGED_FOR_REMOVAL.

Referenced by wm_window_free(), and wm_window_timers_process().