wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
window.c File Reference
#include "window.h"
#include <libbase/libbase.h>
#include <linux/input-event-codes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_seat.h>
#include "bordered.h"
#include "box.h"
#include "container.h"
#include "input.h"
#include "resizebar.h"
#include "surface.h"
#include "test.h"
#include "tile.h"
#include "titlebar.h"
#include "workspace.h"
Include dependency graph for window.c:

Classes

struct  wlmtk_window_vmt_t
 
struct  wlmtk_pending_update_t
 
struct  _wlmtk_window_t
 
struct  wlmtk_fake_window_state_t
 

Macros

#define WLR_USE_UNSTABLE
 Include unstable interfaces of wlroots.
 
#define WLMTK_WINDOW_MAX_PENDING   64
 

Functions

static bool _wlmtk_window_init (wlmtk_window_t *window_ptr, wlmtk_element_t *element_ptr)
 
static void _wlmtk_window_fini (wlmtk_window_t *window_ptr)
 
static wlmtk_window_vmt_t _wlmtk_window_extend (wlmtk_window_t *window_ptr, const wlmtk_window_vmt_t *window_vmt_ptr)
 
static bool _wlmtk_window_element_pointer_button (wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
 
static void _wlmtk_window_container_update_layout (wlmtk_container_t *container_ptr)
 
static void _wlmtk_window_request_minimize (wlmtk_window_t *window_ptr)
 
static void _wlmtk_window_request_move (wlmtk_window_t *window_ptr)
 
static void _wlmtk_window_request_resize (wlmtk_window_t *window_ptr, uint32_t edges)
 
static void _wlmtk_window_create_titlebar (wlmtk_window_t *window_ptr)
 
static void _wlmtk_window_create_resizebar (wlmtk_window_t *window_ptr)
 
static void _wlmtk_window_destroy_titlebar (wlmtk_window_t *window_ptr)
 
static void _wlmtk_window_destroy_resizebar (wlmtk_window_t *window_ptr)
 
static void _wlmtk_window_apply_decoration (wlmtk_window_t *window_ptr)
 
static void _wlmtk_window_request_position_and_size_decorated (wlmtk_window_t *window_ptr, int x, int y, int width, int height, bool include_titlebar, bool include_resizebar, bool include_extra)
 
static wlmtk_pending_update_t_wlmtk_window_prepare_update (wlmtk_window_t *window_ptr)
 
static void _wlmtk_window_release_update (wlmtk_window_t *window_ptr, wlmtk_pending_update_t *update_ptr)
 
static void _wlmtk_window_menu_request_close_handler (struct wl_listener *listener_ptr, void *data_ptr)
 
static struct wlr_output * _wlmtk_window_get_wlr_output (wlmtk_window_t *window_ptr)
 
wlmtk_window_twlmtk_window_create (wlmtk_content_t *content_ptr, const wlmtk_window_style_t *style_ptr, const wlmtk_menu_style_t *menu_style_ptr, struct wlr_seat *wlr_seat_ptr)
 
void wlmtk_window_destroy (wlmtk_window_t *window_ptr)
 
wlmtk_window_events_twlmtk_window_events (wlmtk_window_t *window_ptr)
 
wlmtk_element_twlmtk_window_element (wlmtk_window_t *window_ptr)
 
wlmtk_window_twlmtk_window_from_element (wlmtk_element_t *element_ptr)
 
wlmtk_window_twlmtk_window_from_dlnode (bs_dllist_node_t *dlnode_ptr)
 
bs_dllist_node_t * wlmtk_dlnode_from_window (wlmtk_window_t *window_ptr)
 
void wlmtk_window_set_output (wlmtk_window_t *window_ptr, struct wlr_output *wlr_output_ptr)
 
void wlmtk_window_set_activated (wlmtk_window_t *window_ptr, bool activated)
 
bool wlmtk_window_is_activated (wlmtk_window_t *window_ptr)
 
void wlmtk_window_set_server_side_decorated (wlmtk_window_t *window_ptr, bool decorated)
 
void wlmtk_window_set_properties (wlmtk_window_t *window_ptr, uint32_t properties)
 
void wlmtk_window_set_title (wlmtk_window_t *window_ptr, const char *title_ptr)
 
const char * wlmtk_window_get_title (wlmtk_window_t *window_ptr)
 
void wlmtk_window_request_close (wlmtk_window_t *window_ptr)
 
void wlmtk_window_request_minimize (wlmtk_window_t *window_ptr)
 
void wlmtk_window_request_maximized (wlmtk_window_t *window_ptr, bool maximized)
 
void wlmtk_window_commit_maximized (wlmtk_window_t *window_ptr, bool maximized)
 
bool wlmtk_window_is_maximized (wlmtk_window_t *window_ptr)
 
void wlmtk_window_request_fullscreen (wlmtk_window_t *window_ptr, bool fullscreen)
 
void wlmtk_window_request_fullscreen_position (wlmtk_window_t *window_ptr)
 
void wlmtk_window_commit_fullscreen (wlmtk_window_t *window_ptr, bool fullscreen)
 
bool wlmtk_window_is_fullscreen (wlmtk_window_t *window_ptr)
 
void wlmtk_window_request_shaded (wlmtk_window_t *window_ptr, bool shaded)
 
bool wlmtk_window_is_shaded (wlmtk_window_t *window_ptr)
 
void wlmtk_window_menu_set_enabled (wlmtk_window_t *window_ptr, bool enabled)
 
wlmtk_menu_twlmtk_window_menu (wlmtk_window_t *window_ptr)
 
void wlmtk_window_request_move (wlmtk_window_t *window_ptr)
 
void wlmtk_window_request_resize (wlmtk_window_t *window_ptr, uint32_t edges)
 
void wlmtk_window_set_position (wlmtk_window_t *window_ptr, int x, int y)
 
void wlmtk_window_get_size (wlmtk_window_t *window_ptr, int *width_ptr, int *height_ptr)
 
struct wlr_box wlmtk_window_get_position_and_size (wlmtk_window_t *window_ptr)
 
void wlmtk_window_request_position_and_size (wlmtk_window_t *window_ptr, int x, int y, int width, int height)
 
void wlmtk_window_serial (wlmtk_window_t *window_ptr, uint32_t serial)
 
void wlmtk_window_set_workspace (wlmtk_window_t *window_ptr, wlmtk_workspace_t *workspace_ptr)
 
wlmtk_workspace_twlmtk_window_get_workspace (wlmtk_window_t *window_ptr)
 
const wlmtk_util_client_twlmtk_window_get_client_ptr (wlmtk_window_t *window_ptr)
 
static void _wlmtk_fake_window_request_minimize (wlmtk_window_t *window_ptr)
 
static void _wlmtk_fake_window_request_move (wlmtk_window_t *window_ptr)
 
static void _wlmtk_fake_window_request_resize (wlmtk_window_t *window_ptr, uint32_t edges)
 
wlmtk_fake_window_twlmtk_fake_window_create (void)
 
void wlmtk_fake_window_destroy (wlmtk_fake_window_t *fake_window_ptr)
 
void wlmtk_fake_window_commit_size (wlmtk_fake_window_t *fake_window_ptr)
 
static void test_create_destroy (bs_test_t *test_ptr)
 
static void test_set_title (bs_test_t *test_ptr)
 
static void test_request_close (bs_test_t *test_ptr)
 
static void test_set_activated (bs_test_t *test_ptr)
 
static void test_server_side_decorated (bs_test_t *test_ptr)
 
static void test_server_side_decorated_properties (bs_test_t *test_ptr)
 
static void test_maximize (bs_test_t *test_ptr)
 
static void test_maximize_outputs (bs_test_t *test_ptr)
 
static void test_fullscreen (bs_test_t *test_ptr)
 
static void test_fullscreen_unmap (bs_test_t *test_ptr)
 
static void test_fullscreen_outputs (bs_test_t *test_ptr)
 
static void test_shade (bs_test_t *test_ptr)
 
static void test_fake (bs_test_t *test_ptr)
 

Variables

static const wlmtk_element_vmt_t window_element_vmt
 
static const wlmtk_container_vmt_t window_container_vmt
 
static const wlmtk_window_vmt_t _wlmtk_window_vmt
 
static const uint32_t _wlmtk_window_default_properties
 
static const wlmtk_window_vmt_t _wlmtk_fake_window_vmt
 
const bs_test_case_t wlmtk_window_test_cases []
 
static const wlmtk_tile_style_t _wlmtk_workspace_test_tile_style
 

Detailed Description

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Macro Definition Documentation

◆ WLMTK_WINDOW_MAX_PENDING

#define WLMTK_WINDOW_MAX_PENDING   64

Maximum number of pending state updates.

Function Documentation

◆ _wlmtk_fake_window_request_minimize()

void _wlmtk_fake_window_request_minimize ( wlmtk_window_t window_ptr)
static

Fake implementation of wlmtk_window_request_minimize. Records call.

◆ _wlmtk_fake_window_request_move()

void _wlmtk_fake_window_request_move ( wlmtk_window_t window_ptr)
static

Fake implementation of wlmtk_window_request_move. Records call

◆ _wlmtk_fake_window_request_resize()

void _wlmtk_fake_window_request_resize ( wlmtk_window_t window_ptr,
uint32_t  edges 
)
static

Fake implementation of wlmtk_window_request_resize. Records call.

◆ _wlmtk_window_apply_decoration()

void _wlmtk_window_apply_decoration ( wlmtk_window_t window_ptr)
static

Applies window decoration depending on current state.

◆ _wlmtk_window_container_update_layout()

void _wlmtk_window_container_update_layout ( wlmtk_container_t container_ptr)
static

Implementation of wlmtk_container_vmt_t::update_layout.

Invoked when the window's contained elements triggered a layout update, and will use this to trigger (potential) size updates to the window decorations.

Parameters
container_ptr

◆ _wlmtk_window_create_resizebar()

void _wlmtk_window_create_resizebar ( wlmtk_window_t window_ptr)
static

Creates the resizebar. Expects server_side_decorated to be set.

◆ _wlmtk_window_create_titlebar()

void _wlmtk_window_create_titlebar ( wlmtk_window_t window_ptr)
static

Creates the titlebar. Expects server_side_decorated to be set.

◆ _wlmtk_window_destroy_resizebar()

void _wlmtk_window_destroy_resizebar ( wlmtk_window_t window_ptr)
static

Destroys the resizebar.

◆ _wlmtk_window_destroy_titlebar()

void _wlmtk_window_destroy_titlebar ( wlmtk_window_t window_ptr)
static

Destroys the titlebar.

◆ _wlmtk_window_element_pointer_button()

bool _wlmtk_window_element_pointer_button ( wlmtk_element_t element_ptr,
const wlmtk_button_event_t button_event_ptr 
)
static

Activates window on button press, and calls the parent's implementation.

◆ _wlmtk_window_extend()

wlmtk_window_vmt_t _wlmtk_window_extend ( wlmtk_window_t window_ptr,
const wlmtk_window_vmt_t window_vmt_ptr 
)
static

Extends the window's virtual methods.

Parameters
window_ptr
window_vmt_ptr
Returns
The previous virtual method table.

◆ _wlmtk_window_fini()

void _wlmtk_window_fini ( wlmtk_window_t window_ptr)
static

Uninitializes the window.

Parameters
window_ptr

◆ _wlmtk_window_get_wlr_output()

struct wlr_output * _wlmtk_window_get_wlr_output ( wlmtk_window_t window_ptr)
static

Gets the struct wlr_output that the window prefers, or is on.

Parameters
window_ptr
Returns
Pointer to the struct wlr_output the center of the window is placed on, or NULL.

◆ _wlmtk_window_init()

bool _wlmtk_window_init ( wlmtk_window_t window_ptr,
wlmtk_element_t element_ptr 
)
static

Initializes an (allocated) window.

Parameters
window_ptr
element_ptr
Returns
true on success.

◆ _wlmtk_window_menu_request_close_handler()

void _wlmtk_window_menu_request_close_handler ( struct wl_listener *  listener_ptr,
void *  data_ptr 
)
static

◆ _wlmtk_window_prepare_update()

wlmtk_pending_update_t * _wlmtk_window_prepare_update ( wlmtk_window_t window_ptr)
static

Prepares a positional update: Allocates an item and attach it to the end of the list of pending updates.

Parameters
window_ptr
Returns
A pointer to a wlmtk_pending_update_t, already positioned at the back of wlmtk_window_t::pending_updates.

◆ _wlmtk_window_release_update()

void _wlmtk_window_release_update ( wlmtk_window_t window_ptr,
wlmtk_pending_update_t update_ptr 
)
static

Releases a pending positional update. Moves it to the list of wlmtk_window_t::available_updates.

Parameters
window_ptr
update_ptr

◆ _wlmtk_window_request_minimize()

void _wlmtk_window_request_minimize ( wlmtk_window_t window_ptr)
static

Default implementation of wlmtk_window_request_minimize.

◆ _wlmtk_window_request_move()

void _wlmtk_window_request_move ( wlmtk_window_t window_ptr)
static

Default implementation of wlmtk_window_request_move.

◆ _wlmtk_window_request_position_and_size_decorated()

void _wlmtk_window_request_position_and_size_decorated ( wlmtk_window_t window_ptr,
int  x,
int  y,
int  width,
int  height,
bool  include_titlebar,
bool  include_resizebar,
bool  include_extra 
)
static

Helper: Requests position and size, factoring in decoration.

Parameters
window_ptr
x
y
width
height
include_titlebar
include_resizebar
include_extra

◆ _wlmtk_window_request_resize()

void _wlmtk_window_request_resize ( wlmtk_window_t window_ptr,
uint32_t  edges 
)
static

Default implementation of wlmtk_window_request_resize.

◆ test_create_destroy()

void test_create_destroy ( bs_test_t *  test_ptr)
static

Tests setup and teardown.

◆ test_fake()

void test_fake ( bs_test_t *  test_ptr)
static

Tests fake window ctor and dtor.

◆ test_fullscreen()

void test_fullscreen ( bs_test_t *  test_ptr)
static

Tests turning a window to fullscreen and back.

◆ test_fullscreen_outputs()

void test_fullscreen_outputs ( bs_test_t *  test_ptr)
static

Tests turning a window to fullscreen and back on multiple outputs.

◆ test_fullscreen_unmap()

void test_fullscreen_unmap ( bs_test_t *  test_ptr)
static

Tests that unmapping a fullscreen window works.

◆ test_maximize()

void test_maximize ( bs_test_t *  test_ptr)
static

Tests maximizing and un-maximizing a window.

◆ test_maximize_outputs()

void test_maximize_outputs ( bs_test_t *  test_ptr)
static

Tests maximizing a window on multiple outputs. Must align with output.

◆ test_request_close()

void test_request_close ( bs_test_t *  test_ptr)
static

Tests activation.

◆ test_server_side_decorated()

void test_server_side_decorated ( bs_test_t *  test_ptr)
static

Tests enabling and disabling server-side decoration.

◆ test_server_side_decorated_properties()

void test_server_side_decorated_properties ( bs_test_t *  test_ptr)
static

Tests server-side decoration depending on properties.

◆ test_set_activated()

void test_set_activated ( bs_test_t *  test_ptr)
static

Tests activation.

◆ test_set_title()

void test_set_title ( bs_test_t *  test_ptr)
static

Tests title.

◆ test_shade()

void test_shade ( bs_test_t *  test_ptr)
static

Verifies that window shading hides the element and raises signal.

◆ wlmtk_dlnode_from_window()

bs_dllist_node_t * wlmtk_dlnode_from_window ( wlmtk_window_t window_ptr)

Accessor: Returns pointer to wlmtk_window_t::dlnode.

◆ wlmtk_fake_window_commit_size()

void wlmtk_fake_window_commit_size ( wlmtk_fake_window_t fake_window_ptr)

Calls commit_size with the fake surface's serial and dimensions.

◆ wlmtk_fake_window_create()

wlmtk_fake_window_t * wlmtk_fake_window_create ( void  )

Ctor.

◆ wlmtk_fake_window_destroy()

void wlmtk_fake_window_destroy ( wlmtk_fake_window_t fake_window_ptr)

Dtor.

◆ wlmtk_window_commit_fullscreen()

void wlmtk_window_commit_fullscreen ( wlmtk_window_t window_ptr,
bool  fullscreen 
)

Commits the fullscreen mode for the window.

This is the "commit" part of the potentially asynchronous operation. To be called by wlmtk_content_t, after wlmtk_content_request_fullscreen has completed by the client.

The call is idempotent: Once the window is committed, further calls with the same fullscreen value will return straight away.

Parameters
window_ptr
fullscreen

◆ wlmtk_window_commit_maximized()

void wlmtk_window_commit_maximized ( wlmtk_window_t window_ptr,
bool  maximized 
)

Commits the maximized mode for the window.

This is the "commit" part of the potentially asynchronous operation. To be called by wlmtk_content_t, after wlmtk_content_request_maximized has completed by the client.

The call is idempotent: Once the window is committed, further calls with the same maximized value will return straight away.

Parameters
window_ptr
maximized

◆ wlmtk_window_create()

wlmtk_window_t * wlmtk_window_create ( wlmtk_content_t content_ptr,
const wlmtk_window_style_t style_ptr,
const wlmtk_menu_style_t menu_style_ptr,
struct wlr_seat *  wlr_seat_ptr 
)

Creates a window for the given content.

Parameters
content_ptr
style_ptr
menu_style_ptr
wlr_seat_ptr
Returns
Pointer to the window state, or NULL on error. Must be free'd by calling wlmtk_window_destroy.

◆ wlmtk_window_destroy()

void wlmtk_window_destroy ( wlmtk_window_t window_ptr)

Destroys the window.

Parameters
window_ptr

◆ wlmtk_window_element()

wlmtk_element_t * wlmtk_window_element ( wlmtk_window_t window_ptr)

Returns the super Element of the window.

TODO(kaese.nosp@m.r@gu.nosp@m.bbe.c.nosp@m.h): Re-evaluate whether to work with accessors, or whether to keep the ancestry members public.

Parameters
window_ptr
Returns
Pointer to the wlmtk_element_t base instantiation to window_ptr.

◆ wlmtk_window_events()

wlmtk_window_events_t * wlmtk_window_events ( wlmtk_window_t window_ptr)

Gets the set of events available to a window, for binding listeners.

Parameters
window_ptr
Returns
Pointer to this window's wlmtk_window_t::events.

◆ wlmtk_window_from_dlnode()

wlmtk_window_t * wlmtk_window_from_dlnode ( bs_dllist_node_t *  dlnode_ptr)

Returns wlmtk_window_t for the dlnode_ptr.

◆ wlmtk_window_from_element()

wlmtk_window_t * wlmtk_window_from_element ( wlmtk_element_t element_ptr)

Returns the window from the super Element.

Parameters
element_ptr
Returns
Pointer to the wlmtk_window_t, for which element_ptr is the ancestor.

◆ wlmtk_window_get_client_ptr()

const wlmtk_util_client_t * wlmtk_window_get_client_ptr ( wlmtk_window_t window_ptr)
Returns
Pointer to wlmtk_content_t::client for content_ptr.

◆ wlmtk_window_get_position_and_size()

struct wlr_box wlmtk_window_get_position_and_size ( wlmtk_window_t window_ptr)

Returns the current position and size of the window.

Parameters
window_ptr
Returns
The position of the window (the window's element), and the currently committed width and height of the window.

◆ wlmtk_window_get_size()

void wlmtk_window_get_size ( wlmtk_window_t window_ptr,
int *  width_ptr,
int *  height_ptr 
)

Obtains the size of the window, including potential decorations.

Parameters
window_ptr
width_ptrMay be NULL.
height_ptrMay be NULL.

◆ wlmtk_window_get_title()

const char * wlmtk_window_get_title ( wlmtk_window_t window_ptr)

Returns the title of the window.

Parameters
window_ptr
Returns
Pointer to the window title. Will remain valid until the next call to wlmtk_window_set_title, or until the window is destroyed. Will never be NULL.

◆ wlmtk_window_get_workspace()

wlmtk_workspace_t * wlmtk_window_get_workspace ( wlmtk_window_t window_ptr)
Returns
The value of wlmtk_window_t::workspace_ptr.

◆ wlmtk_window_is_activated()

bool wlmtk_window_is_activated ( wlmtk_window_t window_ptr)

Returns whether the window is activated (has keyboard focus).

Parameters
window_ptr
Returns
activation status.

◆ wlmtk_window_is_fullscreen()

bool wlmtk_window_is_fullscreen ( wlmtk_window_t window_ptr)

Returns whether the window is currently in fullscreen mode.

Will return the state after wlmtk_window_commit_fullscreen has completed.

Parameters
window_ptr
Returns
Whether it's in fullscreen mode or not.

◆ wlmtk_window_is_maximized()

bool wlmtk_window_is_maximized ( wlmtk_window_t window_ptr)

Returns whether the window is currently (requested to be) maximized.

◆ wlmtk_window_is_shaded()

bool wlmtk_window_is_shaded ( wlmtk_window_t window_ptr)

Returns whether the window is currently "shaded".

Parameters
window_ptr
Returns
true if shaded.

◆ wlmtk_window_menu()

wlmtk_menu_t * wlmtk_window_menu ( wlmtk_window_t window_ptr)

Returns a pointer to the window menu's state.

Parameters
window_ptr
Returns
A pointer to the wlmtk_menu_t of the window menu.

◆ wlmtk_window_menu_set_enabled()

void wlmtk_window_menu_set_enabled ( wlmtk_window_t window_ptr,
bool  enabled 
)

Enables (shows) or disabled (hides) the window's menu.

Parameters
window_ptr
enabled

◆ wlmtk_window_request_close()

void wlmtk_window_request_close ( wlmtk_window_t window_ptr)

Requests to close the window.

Parameters
window_ptr

◆ wlmtk_window_request_fullscreen()

void wlmtk_window_request_fullscreen ( wlmtk_window_t window_ptr,
bool  fullscreen 
)

Requests the window to be made fullscreen (or stops so).

Requires the window to be mapped (to a workspace). This may be implemented as an asynchronous operation. Once the window content is ready, it should call wlmtk_window_commit_fullscreen to complete the operation.

Parameters
window_ptr
fullscreenWhether to enable fullscreen mode.

◆ wlmtk_window_request_fullscreen_position()

void wlmtk_window_request_fullscreen_position ( wlmtk_window_t window_ptr)

Requests to (re)position a fullscreen window. A no-op if not fullscreen.

Parameters
window_ptr

◆ wlmtk_window_request_maximized()

void wlmtk_window_request_maximized ( wlmtk_window_t window_ptr,
bool  maximized 
)

Reuests the window to be maximized.

Requires the window to be mapped (to a workspace). Will lookup the maximize extents from the workspace, and request a corresponding updated position and size for the window. wlmtk_window_t::organic_size will not be updated.

This may be implemented as an asynchronous operation. Maximization will be applied once the size change has been committed by the surface.

Parameters
window_ptr
maximized

◆ wlmtk_window_request_minimize()

void wlmtk_window_request_minimize ( wlmtk_window_t window_ptr)

Requests to minimize (iconify) the window.

Parameters
window_ptr

◆ wlmtk_window_request_move()

void wlmtk_window_request_move ( wlmtk_window_t window_ptr)

Requests a move for the window.

Requires the window to be mapped (to a workspace), and forwards the call to wlmtk_workspace_begin_window_move.

Parameters
window_ptr

◆ wlmtk_window_request_position_and_size()

void wlmtk_window_request_position_and_size ( wlmtk_window_t window_ptr,
int  x,
int  y,
int  width,
int  height 
)

Requests an updated position and size for the window, including potential decorations.

This may be implemented as an asynchronous operation. The re-positioning will be applied only once the size change has been committed by the client.

The position and size will be stored in wlmtk_window_t::organic_size.

Parameters
window_ptr
x
y
width
height

◆ wlmtk_window_request_resize()

void wlmtk_window_request_resize ( wlmtk_window_t window_ptr,
uint32_t  edges 
)

Requests the window to be resized.

Requires the window to be mapped (to a workspace), and forwards the call to wlmtk_workspace_begin_window_resize.

Parameters
window_ptr
edges

◆ wlmtk_window_request_shaded()

void wlmtk_window_request_shaded ( wlmtk_window_t window_ptr,
bool  shaded 
)

Requests the window to be "shaded", ie. rolled-up to just the title bar.

This is supported only for server-side decorated windows.

Parameters
window_ptr
shaded

◆ wlmtk_window_serial()

void wlmtk_window_serial ( wlmtk_window_t window_ptr,
uint32_t  serial 
)

Updates the window state to what was requested at the serial.

Used for example when resizing a window from the top or left edges. In that case, wlmtk_content_request_size may be asynchronous and returns a serial. The surface is expected to call wlmtk_window_serial with the returned serial when the size is committed. Only then, the corresponding positional update on the top/left edges are supposed to be applied.

wlmtk_window_t::organic_size will be updated, if there was no pending update: Meaning that the commit originated not from an earlier wlmtk_window_request_position_and_size or wlmtk_window_request_maximized call.

Parameters
window_ptr
serial

◆ wlmtk_window_set_activated()

void wlmtk_window_set_activated ( wlmtk_window_t window_ptr,
bool  activated 
)

Sets the window as activated, depending on the argument's value.

An activated window will have keyboard focus and would have distinct decorations to indicate state.

Parameters
window_ptr
activated

◆ wlmtk_window_set_output()

void wlmtk_window_set_output ( wlmtk_window_t window_ptr,
struct wlr_output *  wlr_output_ptr 
)

Sets the output for the window. Used for fullscreen requests.

Parameters
window_ptr
wlr_output_ptrOutput to consider when requesting a window as fullscreen. Can be NULL to indicate no preference.

◆ wlmtk_window_set_position()

void wlmtk_window_set_position ( wlmtk_window_t window_ptr,
int  x,
int  y 
)

Sets the window's position. This is a synchronous operation.

Updates the position in wlmtk_window_t::organic_size.

Parameters
window_ptr
x
y

◆ wlmtk_window_set_properties()

void wlmtk_window_set_properties ( wlmtk_window_t window_ptr,
uint32_t  properties 
)

Sets the window's properties.

Parameters
window_ptr
propertiesSee wlmtk_window_property_t.

◆ wlmtk_window_set_server_side_decorated()

void wlmtk_window_set_server_side_decorated ( wlmtk_window_t window_ptr,
bool  decorated 
)

Sets whether to have server-side decorations for this window.

Parameters
window_ptr
decorated

◆ wlmtk_window_set_title()

void wlmtk_window_set_title ( wlmtk_window_t window_ptr,
const char *  title_ptr 
)

Sets the title for the window.

If title_ptr is NULL, a generic name is set.

Parameters
window_ptr
title_ptrMay be NULL.

◆ wlmtk_window_set_workspace()

void wlmtk_window_set_workspace ( wlmtk_window_t window_ptr,
wlmtk_workspace_t workspace_ptr 
)

Sets wlmtk_window_t::workspace_ptr.

Protected method, to be called only from wlmtk_workspace_t.

Parameters
window_ptr
workspace_ptr

Variable Documentation

◆ _wlmtk_fake_window_vmt

const wlmtk_window_vmt_t _wlmtk_fake_window_vmt
static
Initial value:
= {
}
static void _wlmtk_fake_window_request_minimize(wlmtk_window_t *window_ptr)
Definition window.c:1385
static void _wlmtk_fake_window_request_resize(wlmtk_window_t *window_ptr, uint32_t edges)
Definition window.c:1403
static void _wlmtk_fake_window_request_move(wlmtk_window_t *window_ptr)
Definition window.c:1394

Virtual method table for the fake window itself.

◆ _wlmtk_window_default_properties

const uint32_t _wlmtk_window_default_properties
static
Initial value:
=
@ WLMTK_WINDOW_PROPERTY_ICONIFIABLE
Definition window.h:68
@ WLMTK_WINDOW_PROPERTY_CLOSABLE
Definition window.h:70
@ WLMTK_WINDOW_PROPERTY_RESIZABLE
Definition window.h:66

Default properties. Override by wlmtk_window_set_properties.

◆ _wlmtk_window_vmt

const wlmtk_window_vmt_t _wlmtk_window_vmt
static
Initial value:
= {
.request_minimize = _wlmtk_window_request_minimize,
.request_move = _wlmtk_window_request_move,
.request_resize = _wlmtk_window_request_resize,
}
static void _wlmtk_window_request_minimize(wlmtk_window_t *window_ptr)
Definition window.c:997
static void _wlmtk_window_request_move(wlmtk_window_t *window_ptr)
Definition window.c:1004
static void _wlmtk_window_request_resize(wlmtk_window_t *window_ptr, uint32_t edges)
Definition window.c:1013

Virtual method table for the window itself.

◆ _wlmtk_workspace_test_tile_style

const wlmtk_tile_style_t _wlmtk_workspace_test_tile_style
static
Initial value:
= {
.size = 64
}

Tile style used in tests.

◆ window_container_vmt

const wlmtk_container_vmt_t window_container_vmt
static
Initial value:
= {
}
static void _wlmtk_window_container_update_layout(wlmtk_container_t *container_ptr)
Definition window.c:976

Virtual method table for the window's container superclass.

◆ window_element_vmt

const wlmtk_element_vmt_t window_element_vmt
static
Initial value:
= {
}
static bool _wlmtk_window_element_pointer_button(wlmtk_element_t *element_ptr, const wlmtk_button_event_t *button_event_ptr)
Definition window.c:914

Virtual method table for the window's element superclass.

◆ wlmtk_window_test_cases

const bs_test_case_t wlmtk_window_test_cases[]
Initial value:
= {
{ 1, "create_destroy", test_create_destroy },
{ 1, "set_title", test_set_title },
{ 1, "request_close", test_request_close },
{ 1, "set_activated", test_set_activated },
{ 1, "set_server_side_decorated", test_server_side_decorated },
{ 1, "set_server_side_decorated_properties",
{ 1, "maximize", test_maximize },
{ 1, "maximize_outputs", test_maximize_outputs },
{ 1, "fullscreen", test_fullscreen },
{ 1, "fullscreen_unmap", test_fullscreen_unmap },
{ 1, "fullscreen_outputs", test_fullscreen_outputs },
{ 1, "shade", test_shade },
{ 1, "fake", test_fake },
{ 0, NULL, NULL }
}
static void test_fullscreen_outputs(bs_test_t *test_ptr)
Definition window.c:1936
static void test_server_side_decorated_properties(bs_test_t *test_ptr)
Definition window.c:1598
static void test_maximize_outputs(bs_test_t *test_ptr)
Definition window.c:1740
static void test_create_destroy(bs_test_t *test_ptr)
Definition window.c:1454
static void test_fake(bs_test_t *test_ptr)
Definition window.c:2119
static void test_fullscreen(bs_test_t *test_ptr)
Definition window.c:1822
static void test_request_close(bs_test_t *test_ptr)
Definition window.c:1501
static void test_maximize(bs_test_t *test_ptr)
Definition window.c:1640
static void test_fullscreen_unmap(bs_test_t *test_ptr)
Definition window.c:2011
static void test_set_title(bs_test_t *test_ptr)
Definition window.c:1479
static void test_server_side_decorated(bs_test_t *test_ptr)
Definition window.c:1532
static void test_set_activated(bs_test_t *test_ptr)
Definition window.c:1516
static void test_shade(bs_test_t *test_ptr)
Definition window.c:2068

Unit tests for window.