Blender V4.5
GHOST_WindowWayland Class Reference

#include <GHOST_WindowWayland.hh>

Inherits GHOST_Window.

Public Member Functions

Public WAYLAND Direct Data Access

Expose some members via methods.

int scale_get () const
 
const struct GWL_WindowScaleParamsscale_params_get () const
 
struct wl_surfacewl_surface_get () const
 
const std::vector< GWL_Output * > & outputs_get ()
 
wl_fixed_t wl_fixed_from_window (wl_fixed_t value) const
 
wl_fixed_t wl_fixed_to_window (wl_fixed_t value) const
 
Public WAYLAND Window Level Functions

High Level Windowing Utilities.

GHOST_TSuccess activate ()
 
GHOST_TSuccess deactivate ()
 
GHOST_TSuccess close ()
 
GHOST_TSuccess notify_size ()
 
GHOST_TSuccess notify_decor_redraw ()
 
Public WAYLAND Utility Functions

Functionality only used for the WAYLAND implementation.

GHOST_TSuccess cursor_shape_refresh ()
 
bool outputs_enter (GWL_Output *output)
 
bool outputs_leave (GWL_Output *output)
 
bool outputs_changed_update_scale ()
 
void outputs_changed_update_scale_tag ()
 
void pending_actions_handle ()
 
- Public Member Functions inherited from GHOST_Window
 GHOST_Window (uint32_t width, uint32_t height, GHOST_TWindowState state, const bool wantStereoVisual=false, const bool exclusive=false)
 
 ~GHOST_Window () override
 
void * getOSWindow () const override
 
GHOST_TSuccess setPath (const char *) override
 
virtual GHOST_TWindowDecorationStyleFlags getWindowDecorationStyleFlags () override
 
virtual void setWindowDecorationStyleFlags (GHOST_TWindowDecorationStyleFlags styleFlags) override
 
virtual void setWindowDecorationStyleSettings (GHOST_WindowDecorationStyleSettings decorationSettings) override
 
virtual GHOST_TSuccess applyWindowDecorationStyle () override
 
GHOST_TStandardCursor getCursorShape () const override
 
GHOST_TSuccess setCursorShape (GHOST_TStandardCursor cursorShape) override
 
GHOST_TSuccess setCustomCursorShape (uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor) override
 
bool getCursorVisibility () const override
 
GHOST_TGrabCursorMode getCursorGrabMode () const
 
bool getCursorGrabModeIsWarp () const
 
GHOST_TAxisFlag getCursorGrabAxis () const
 
void getCursorGrabInitPos (int32_t &x, int32_t &y) const
 
void getCursorGrabAccum (int32_t &x, int32_t &y) const
 
void setCursorGrabAccum (int32_t x, int32_t y)
 
GHOST_TSuccess setCursorVisibility (bool visible) override
 
GHOST_TSuccess setCursorGrab (GHOST_TGrabCursorMode mode, GHOST_TAxisFlag wrap_axis, GHOST_Rect *bounds, int32_t mouse_ungrab_xy[2]) override
 
GHOST_TSuccess getCursorGrabBounds (GHOST_Rect &bounds) const override
 
void getCursorGrabState (GHOST_TGrabCursorMode &mode, GHOST_TAxisFlag &wrap_axis, GHOST_Rect &bounds, bool &use_software_cursor) override
 
GHOST_TSuccess setProgressBar (float) override
 
GHOST_TSuccess endProgressBar () override
 
GHOST_TSuccess setSwapInterval (int interval) override
 
GHOST_TSuccess getSwapInterval (int &intervalOut) override
 
void setAcceptDragOperation (bool canAccept) override
 
bool canAcceptDragOperation () const override
 
GHOST_TSuccess setModifiedState (bool isUnsavedChanges) override
 
bool getModifiedState () override
 
GHOST_TDrawingContextType getDrawingContextType () override
 
GHOST_TSuccess setDrawingContextType (GHOST_TDrawingContextType type) override
 
GHOST_IContextgetDrawingContext () override
 
GHOST_TSuccess activateDrawingContext () override
 
GHOST_TSuccess updateDrawingContext ()
 
GHOST_ContextgetContext ()
 
unsigned int getDefaultFramebuffer () override
 
GHOST_TUserDataPtr getUserData () const override
 
void setUserData (const GHOST_TUserDataPtr userData) override
 
float getNativePixelSize () override
 
- Public Member Functions inherited from GHOST_IWindow
virtual ~GHOST_IWindow ()=default
 

GHOST Implementation

WAYLAND specific implementation of the GHOST_Window interface.

GHOST_TSuccess hasCursorShape (GHOST_TStandardCursor cursorShape) override
 
 GHOST_WindowWayland (GHOST_SystemWayland *system, const char *title, int32_t left, int32_t top, uint32_t width, uint32_t height, GHOST_TWindowState state, const GHOST_IWindow *parentWindow, GHOST_TDrawingContextType type, const bool is_dialog, const bool stereoVisual, const bool exclusive, const bool is_debug, const GHOST_GPUDevice &preferred_device)
 
 ~GHOST_WindowWayland () override
 
GHOST_TSuccess swapBuffers () override
 
uint16_t getDPIHint () override
 
GHOST_TSuccess setWindowCursorGrab (GHOST_TGrabCursorMode mode) override
 
GHOST_TSuccess setWindowCursorShape (GHOST_TStandardCursor shape) override
 
GHOST_TSuccess setWindowCustomCursorShape (uint8_t *bitmap, uint8_t *mask, int sizex, int sizey, int hotX, int hotY, bool canInvertColor) override
 
bool getCursorGrabUseSoftwareDisplay () override
 
GHOST_TSuccess getCursorBitmap (GHOST_CursorBitmapRef *bitmap) override
 
bool getValid () const override
 
void setTitle (const char *title) override
 
std::string getTitle () const override
 
void getWindowBounds (GHOST_Rect &bounds) const override
 
void getClientBounds (GHOST_Rect &bounds) const override
 
GHOST_TSuccess setClientWidth (uint32_t width) override
 
GHOST_TSuccess setClientHeight (uint32_t height) override
 
GHOST_TSuccess setClientSize (uint32_t width, uint32_t height) override
 
void screenToClient (int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
 
void clientToScreen (int32_t inX, int32_t inY, int32_t &outX, int32_t &outY) const override
 
GHOST_TSuccess setWindowCursorVisibility (bool visible) override
 
GHOST_TSuccess setState (GHOST_TWindowState state) override
 
GHOST_TWindowState getState () const override
 
GHOST_TSuccess invalidate () override
 
GHOST_TSuccess setOrder (GHOST_TWindowOrder order) override
 
bool isDialog () const override
 

Additional Inherited Members

- Protected Member Functions inherited from GHOST_Window
GHOST_TSuccess releaseNativeHandles ()
 
- Protected Attributes inherited from GHOST_Window
GHOST_TDrawingContextType m_drawingContextType
 
GHOST_TUserDataPtr m_userData
 
bool m_cursorVisible
 
GHOST_TGrabCursorMode m_cursorGrab
 
GHOST_TAxisFlag m_cursorGrabAxis
 
int32_t m_cursorGrabInitPos [2]
 
int32_t m_cursorGrabAccumPos [2]
 
GHOST_Rect m_cursorGrabBounds
 
GHOST_TStandardCursor m_cursorShape
 
bool m_progressBarVisible
 
bool m_canAcceptDragOperation
 
bool m_isUnsavedChanges
 
bool m_fullScreen
 
GHOST_TWindowDecorationStyleFlags m_windowDecorationStyleFlags
 
GHOST_WindowDecorationStyleSettings m_windowDecorationStyleSettings
 
bool m_wantStereoVisual
 
uint32_t m_fullScreenWidth
 
uint32_t m_fullScreenHeight
 
float m_nativePixelSize
 

Detailed Description

Definition at line 65 of file GHOST_WindowWayland.hh.

Constructor & Destructor Documentation

◆ GHOST_WindowWayland()

GHOST_WindowWayland::GHOST_WindowWayland ( GHOST_SystemWayland * system,
const char * title,
int32_t left,
int32_t top,
uint32_t width,
uint32_t height,
GHOST_TWindowState state,
const GHOST_IWindow * parentWindow,
GHOST_TDrawingContextType type,
const bool is_dialog,
const bool stereoVisual,
const bool exclusive,
const bool is_debug,
const GHOST_GPUDevice & preferred_device )

Definition at line 1773 of file GHOST_WindowWayland.cc.

References GWL_Window::backend, GWL_WindowFrame::buffer_scale, FRACTIONAL_DENOMINATOR, GWL_WindowFrame::fractional_scale, GWL_Window::fractional_scale_handle, GWL_WindowFrame::fractional_scale_preferred, GWL_Window::frame, GWL_Window::frame_pending, GHOST_ASSERT, GWL_Window::ghost_context_type, GHOST_kFailure, GHOST_PRINT, GWL_Window::ghost_system, GWL_Window::ghost_window, ghost_wl_display_report_error_if_set(), ghost_wl_surface_tag(), gwl_round_int2_by(), gwl_round_int_test(), gwl_window_frame_pending_fractional_scale_set_notest(), gwl_window_state_get(), gwl_window_state_set(), gwl_window_state_set_for_xdg(), gwl_window_title_set(), GWL_XDG_Decor_Window::initial_bounds, GWL_XDG_Decor_Window::initial_configure_seen, GWL_Window::is_dialog, GWL_Window::is_init, GWL_WindowFrame::is_scale_init, GWL_Window::is_valid_setup, libdecor_decorate, libdecor_frame_get_xdg_toplevel, libdecor_frame_map, libdecor_frame_set_app_id, libdecor_frame_set_min_content_size, libdecor_frame_set_parent, outputs_changed_update_scale(), GHOST_SystemWayland::outputs_get(), outputs_uniform_scale_or_default(), GHOST_SystemWayland::server_mutex, GHOST_Window::setDrawingContextType(), GHOST_Window::setSwapInterval(), GWL_WindowFrame::size, state, GWL_Window::surface, GWL_XDG_Decor_Window::surface, GWL_XDG_Decor_Window::toplevel, GWL_XDG_Decor_Window::toplevel_decor, UNPACK2, GWL_Window::wl, GHOST_SystemWayland::wl_compositor_get(), wl_display, wl_display_dispatch, wl_display_flush, GHOST_SystemWayland::wl_display_get(), wl_display_roundtrip, wl_egl_window_create, wl_surface_listener, GWL_Window::wp, wp_fractional_scale_listener, GHOST_SystemWayland::wp_fractional_scale_manager_get(), GHOST_SystemWayland::xdg_app_id_get(), GWL_Window::xdg_decor, GHOST_SystemWayland::xdg_decor_manager_get(), GHOST_SystemWayland::xdg_decor_shell_get(), xdg_surface_listener, xdg_toplevel_decoration_v1_listener, and xdg_toplevel_listener.

◆ ~GHOST_WindowWayland()

Member Function Documentation

◆ activate()

GHOST_TSuccess GHOST_WindowWayland::activate ( )

◆ clientToScreen()

void GHOST_WindowWayland::clientToScreen ( int32_t inX,
int32_t inY,
int32_t & outX,
int32_t & outY ) const
overridevirtual

Converts a point in client rectangle coordinates to screen coordinates.

Parameters
inXThe x-coordinate in the client rectangle.
inYThe y-coordinate in the client rectangle.
outXThe x-coordinate on the screen.
outYThe y-coordinate on the screen.

Implements GHOST_IWindow.

Definition at line 2411 of file GHOST_WindowWayland.cc.

◆ close()

◆ cursor_shape_refresh()

GHOST_TSuccess GHOST_WindowWayland::cursor_shape_refresh ( )

Refresh the cursor using the cursor assigned to this window.

Note
This is needed because in GHOST the cursor is per window, where as in WAYLAND the cursor is set per-seat (and per input device). When an input device enters a window, this function must run.

Definition at line 2702 of file GHOST_WindowWayland.cc.

References GWL_Window::cursor_custom_shape, GHOST_kSuccess, gwl_window_cursor_shape_refresh(), gwl_window_pending_actions_tag(), GHOST_Window::m_cursorShape, GHOST_SystemWayland::main_thread_id, and PENDING_WINDOW_CURSOR_SHAPE_REFRESH.

Referenced by pointer_handle_enter(), tablet_tool_handle_frame(), and tablet_tool_handle_proximity_in().

◆ deactivate()

GHOST_TSuccess GHOST_WindowWayland::deactivate ( )

◆ getClientBounds()

void GHOST_WindowWayland::getClientBounds ( GHOST_Rect & bounds) const
overridevirtual

Returns the client rectangle dimensions. The left and top members of the rectangle are always zero.

Parameters
boundsThe bounding rectangle of the client area of the window.

Implements GHOST_IWindow.

Definition at line 2368 of file GHOST_WindowWayland.cc.

References bounds(), GWL_Window::frame, GWL_WindowFrame::size, and UNPACK2.

Referenced by getCursorPositionClientRelative_impl(), getWindowBounds(), relative_pointer_handle_relative_motion_impl(), and setWindowCursorGrab().

◆ getCursorBitmap()

GHOST_TSuccess GHOST_WindowWayland::getCursorBitmap ( GHOST_CursorBitmapRef * bitmap)
overridevirtual

◆ getCursorGrabUseSoftwareDisplay()

bool GHOST_WindowWayland::getCursorGrabUseSoftwareDisplay ( )
overridevirtual

Return true when a software cursor should be used.

Reimplemented from GHOST_Window.

Definition at line 2287 of file GHOST_WindowWayland.cc.

References GHOST_SystemWayland::cursor_grab_use_software_display_get(), GHOST_Window::m_cursorGrab, and GHOST_SystemWayland::server_mutex.

◆ getDPIHint()

uint16_t GHOST_WindowWayland::getDPIHint ( )
overridevirtual

Returns the recommended DPI for this window.

Returns
The recommended DPI for this window.

Reimplemented from GHOST_Window.

Definition at line 2420 of file GHOST_WindowWayland.cc.

References base_dpi, GWL_WindowFrame::buffer_scale, GWL_WindowFrame::fractional_scale, GWL_Window::frame, and gwl_window_fractional_to_viewport().

◆ getState()

GHOST_TWindowState GHOST_WindowWayland::getState ( ) const
overridevirtual

Returns the state of the window (normal, minimized, maximized).

Returns
The state of the window.

Implements GHOST_IWindow.

Definition at line 2457 of file GHOST_WindowWayland.cc.

References gwl_window_state_get(), and GHOST_SystemWayland::server_mutex.

◆ getTitle()

std::string GHOST_WindowWayland::getTitle ( ) const
overridevirtual

Returns the title displayed in the title bar.

Parameters
titleThe title displayed in the title bar.

Implements GHOST_IWindow.

Definition at line 2357 of file GHOST_WindowWayland.cc.

References GWL_Window::title.

◆ getValid()

bool GHOST_WindowWayland::getValid ( ) const
overridevirtual

Returns indication as to whether the window is valid.

Returns
The validity of the window.

Reimplemented from GHOST_Window.

Definition at line 2344 of file GHOST_WindowWayland.cc.

References GHOST_Window::getValid(), and GWL_Window::is_valid_setup.

Referenced by GHOST_SystemWayland::createWindow().

◆ getWindowBounds()

void GHOST_WindowWayland::getWindowBounds ( GHOST_Rect & bounds) const
overridevirtual

Returns the window rectangle dimensions. These are screen coordinates.

Parameters
boundsThe bounding rectangle of the window.

Implements GHOST_IWindow.

Definition at line 2363 of file GHOST_WindowWayland.cc.

References bounds(), and getClientBounds().

◆ hasCursorShape()

GHOST_TSuccess GHOST_WindowWayland::hasCursorShape ( GHOST_TStandardCursor cursorShape)
overridevirtual

Test if the standard cursor shape is supported by current platform.

Returns
Indication of success.

Implements GHOST_IWindow.

Definition at line 2210 of file GHOST_WindowWayland.cc.

References GHOST_SystemWayland::cursor_shape_check().

◆ invalidate()

GHOST_TSuccess GHOST_WindowWayland::invalidate ( )
overridevirtual

Invalidates the contents of this window.

Returns
Indication of success.

Implements GHOST_IWindow.

Definition at line 2465 of file GHOST_WindowWayland.cc.

References GHOST_kSuccess.

◆ isDialog()

bool GHOST_WindowWayland::isDialog ( ) const
overridevirtual

Reimplemented from GHOST_Window.

Definition at line 2483 of file GHOST_WindowWayland.cc.

References GWL_Window::is_dialog.

◆ notify_decor_redraw()

GHOST_TSuccess GHOST_WindowWayland::notify_decor_redraw ( )

◆ notify_size()

◆ outputs_changed_update_scale()

◆ outputs_changed_update_scale_tag()

◆ outputs_enter()

bool GHOST_WindowWayland::outputs_enter ( GWL_Output * output)

Definition at line 2882 of file GHOST_WindowWayland.cc.

References output, GWL_Window::outputs, and outputs.

Referenced by surface_handle_enter().

◆ outputs_get()

const std::vector< GWL_Output * > & GHOST_WindowWayland::outputs_get ( )

◆ outputs_leave()

bool GHOST_WindowWayland::outputs_leave ( GWL_Output * output)

◆ pending_actions_handle()

void GHOST_WindowWayland::pending_actions_handle ( )

◆ scale_get()

int GHOST_WindowWayland::scale_get ( ) const

◆ scale_params_get()

◆ screenToClient()

void GHOST_WindowWayland::screenToClient ( int32_t inX,
int32_t inY,
int32_t & outX,
int32_t & outY ) const
overridevirtual

Converts a point in screen coordinates to client rectangle coordinates

Parameters
inXThe x-coordinate on the screen.
inYThe y-coordinate on the screen.
outXThe x-coordinate in the client rectangle.
outYThe y-coordinate in the client rectangle.

Implements GHOST_IWindow.

Definition at line 2402 of file GHOST_WindowWayland.cc.

◆ setClientHeight()

GHOST_TSuccess GHOST_WindowWayland::setClientHeight ( uint32_t height)
overridevirtual

Resizes client rectangle height.

Parameters
heightThe new height of the client area of the window.

Implements GHOST_IWindow.

Definition at line 2379 of file GHOST_WindowWayland.cc.

References GWL_Window::frame, setClientSize(), and GWL_WindowFrame::size.

◆ setClientSize()

GHOST_TSuccess GHOST_WindowWayland::setClientSize ( uint32_t width,
uint32_t height )
overridevirtual

Resizes client rectangle.

Parameters
widthThe new width of the client area of the window.
heightThe new height of the client area of the window.

Implements GHOST_IWindow.

Definition at line 2384 of file GHOST_WindowWayland.cc.

References GWL_WindowFrame::buffer_scale, GWL_Window::frame_pending, GWL_Window::frame_pending_mutex, GHOST_kSuccess, gwl_round_int2_by(), gwl_window_frame_pending_size_set(), GHOST_SystemWayland::server_mutex, and GWL_WindowFrame::size.

Referenced by setClientHeight(), and setClientWidth().

◆ setClientWidth()

GHOST_TSuccess GHOST_WindowWayland::setClientWidth ( uint32_t width)
overridevirtual

Resizes client rectangle width.

Parameters
widthThe new width of the client area of the window.

Implements GHOST_IWindow.

Definition at line 2374 of file GHOST_WindowWayland.cc.

References GWL_Window::frame, setClientSize(), and GWL_WindowFrame::size.

◆ setOrder()

GHOST_TSuccess GHOST_WindowWayland::setOrder ( GHOST_TWindowOrder order)
overridevirtual

Sets the order of the window (bottom, top).

Parameters
orderThe order of the window.
Returns
Indication of success.

Implements GHOST_IWindow.

Definition at line 2470 of file GHOST_WindowWayland.cc.

References GHOST_kSuccess, GHOST_kWindowOrderTop, and gwl_window_activate().

◆ setState()

GHOST_TSuccess GHOST_WindowWayland::setState ( GHOST_TWindowState state)
overridevirtual

Sets the state of the window (normal, minimized, maximized).

Parameters
stateThe state of the window.
Returns
Indication of success.

Implements GHOST_IWindow.

Definition at line 2449 of file GHOST_WindowWayland.cc.

References GHOST_kFailure, GHOST_kSuccess, gwl_window_state_set(), GHOST_SystemWayland::server_mutex, and state.

◆ setTitle()

void GHOST_WindowWayland::setTitle ( const char * title)
overridevirtual

Sets the title displayed in the title bar.

Parameters
titleThe title to display in the title bar.

Implements GHOST_IWindow.

Definition at line 2349 of file GHOST_WindowWayland.cc.

References gwl_window_title_set(), and GHOST_SystemWayland::server_mutex.

◆ setWindowCursorGrab()

◆ setWindowCursorShape()

◆ setWindowCursorVisibility()

GHOST_TSuccess GHOST_WindowWayland::setWindowCursorVisibility ( bool visible)
overridevirtual

Sets the cursor visibility on the window using native window system calls.

Implements GHOST_Window.

Definition at line 2432 of file GHOST_WindowWayland.cc.

References GHOST_SystemWayland::cursor_visibility_set(), GHOST_kSuccess, GHOST_SystemWayland::server_mutex, wl_display, wl_display_dispatch_pending, wl_display_flush, and GHOST_SystemWayland::wl_display_get().

◆ setWindowCustomCursorShape()

◆ swapBuffers()

GHOST_TSuccess GHOST_WindowWayland::swapBuffers ( )
overridevirtual

Swaps front and back buffers of a window.

Returns
A boolean success indicator.

Reimplemented from GHOST_Window.

Definition at line 2203 of file GHOST_WindowWayland.cc.

References GHOST_ASSERT, GHOST_SystemWayland::main_thread_id, and GHOST_Window::swapBuffers().

◆ wl_fixed_from_window()

◆ wl_fixed_to_window()

wl_fixed_t GHOST_WindowWayland::wl_fixed_to_window ( wl_fixed_t value) const

◆ wl_surface_get()

wl_surface * GHOST_WindowWayland::wl_surface_get ( ) const

Definition at line 2602 of file GHOST_WindowWayland.cc.

References GWL_Window::surface, and GWL_Window::wl.

Referenced by gwl_window_activate().


The documentation for this class was generated from the following files: