wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
xdg_toplevel.c File Reference
#include "xdg_toplevel.h"
#include <libbase/libbase.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <wayland-server-core.h>
#include <wayland-server-protocol.h>
#include <wayland-server.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_output.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_scene.h>
#include <wlr/types/wlr_xdg_shell.h>
#include <wlr/util/box.h>
#include "server.h"
#include "tl_menu.h"
#include "toolkit/toolkit.h"
#include "xdg_popup.h"
Include dependency graph for xdg_toplevel.c:

Classes

struct  wlmaker_xdg_toplevel
 
struct  _wlmaker_test_layout
 
struct  _xdg_toplevel_test_data
 

Functions

struct wlmaker_xdg_toplevel_wlmaker_xdg_toplevel_create_injected (struct wlr_xdg_toplevel *wlr_xdg_toplevel_ptr, wlmaker_server_t *server_ptr, uint32_t(*_set_maximized)(struct wlr_xdg_toplevel *, bool), uint32_t(*_set_fullscreen)(struct wlr_xdg_toplevel *, bool), uint32_t(*_set_size)(struct wlr_xdg_toplevel *, int32_t, int32_t), uint32_t(*_set_activated)(struct wlr_xdg_toplevel *, bool))
 
static void _wlmaker_xdg_toplevel_flush_properties (struct wlmaker_xdg_toplevel *wxt_ptr)
 
static void _wlmaker_xdg_toplevel_handle_destroy (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_request_maximize (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_request_fullscreen (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_request_minimize (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_request_move (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_request_resize (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_request_show_window_menu (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_set_parent (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_set_title (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_set_app_id (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_new_popup (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_surface_map (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_surface_unmap (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_surface_commit (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_window_request_close (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_window_set_activated (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_window_request_size (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_window_request_fullscreen (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_xdg_toplevel_handle_window_request_maximized (struct wl_listener *listener_ptr, void *data_ptr)
 
struct wlmaker_xdg_toplevelwlmaker_xdg_toplevel_create (struct wlr_xdg_toplevel *wlr_xdg_toplevel_ptr, wlmaker_server_t *server_ptr)
 
void wlmaker_xdg_toplevel_destroy (struct wlmaker_xdg_toplevel *wxt_ptr)
 
void wlmaker_xdg_toplevel_set_server_side_decorated (struct wlmaker_xdg_toplevel *wlmaker_xdg_toplevel_ptr, bool server_side_decorated)
 
static bool _wlmaker_test_layout_init (struct _wlmaker_test_layout *tl_ptr)
 
static void _wlmaker_test_layout_fini (struct _wlmaker_test_layout *tl_ptr)
 
uint32_t _wlmaker_xdg_toplevel_fake_set_maximized (struct wlr_xdg_toplevel *wlr_xdg_toplevel_ptr, bool maximized)
 
uint32_t _wlmaker_xdg_toplevel_fake_set_fullscreen (struct wlr_xdg_toplevel *wlr_xdg_toplevel_ptr, bool fullscreen)
 
uint32_t _wlmaker_xdg_toplevel_fake_set_size (struct wlr_xdg_toplevel *wlr_xdg_toplevel_ptr, int32_t width, int32_t height)
 
uint32_t _wlmaker_xdg_toplevel_fake_set_activated (struct wlr_xdg_toplevel *wlr_xdg_toplevel_ptr, bool activated)
 
static void * _wlmaker_xdg_toplevel_test_setup (void)
 
static void _wlmaker_xdg_toplevel_test_teardown (void *test_context_ptr)
 
static void _wlmaker_xdg_toplevel_test_maximize (bs_test_t *test_ptr)
 
static void _wlmaker_xdg_toplevel_test_fullscreen (bs_test_t *test_ptr)
 
static void _wlmaker_xdg_toplevel_test_size (bs_test_t *test_ptr)
 
static void _wlmaker_xdg_toplevel_test_activated (bs_test_t *test_ptr)
 

Variables

const bs_test_case_t _test_cases []
 
const bs_test_set_t wlmaker_xdg_toplevel_test_set
 

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.

Function Documentation

◆ _wlmaker_test_layout_fini()

void _wlmaker_test_layout_fini ( struct _wlmaker_test_layout tl_ptr)
static

Un-initializes _wlmaker_test_layout

◆ _wlmaker_test_layout_init()

bool _wlmaker_test_layout_init ( struct _wlmaker_test_layout tl_ptr)
static

Initializes _wlmaker_test_layout

◆ _wlmaker_xdg_toplevel_create_injected()

struct wlmaker_xdg_toplevel * _wlmaker_xdg_toplevel_create_injected ( struct wlr_xdg_toplevel *  wlr_xdg_toplevel_ptr,
wlmaker_server_t server_ptr,
uint32_t(*)(struct wlr_xdg_toplevel *, bool)  _set_maximized,
uint32_t(*)(struct wlr_xdg_toplevel *, bool)  _set_fullscreen,
uint32_t(*)(struct wlr_xdg_toplevel *, int32_t, int32_t)  _set_size,
uint32_t(*)(struct wlr_xdg_toplevel *, bool)  _set_activated 
)

Creates the toplevel, permitting injected calls to set properties.

◆ _wlmaker_xdg_toplevel_fake_set_activated()

uint32_t _wlmaker_xdg_toplevel_fake_set_activated ( struct wlr_xdg_toplevel *  wlr_xdg_toplevel_ptr,
bool  activated 
)

A fake for wlr_xdg_toplevel_set_activated(). Recods the call.

◆ _wlmaker_xdg_toplevel_fake_set_fullscreen()

uint32_t _wlmaker_xdg_toplevel_fake_set_fullscreen ( struct wlr_xdg_toplevel *  wlr_xdg_toplevel_ptr,
bool  fullscreen 
)

A fake for wlr_xdg_toplevel_set_fullscreen(). Records the call.

◆ _wlmaker_xdg_toplevel_fake_set_maximized()

uint32_t _wlmaker_xdg_toplevel_fake_set_maximized ( struct wlr_xdg_toplevel *  wlr_xdg_toplevel_ptr,
bool  maximized 
)

A fake for wlr_xdg_toplevel_set_maximized(). Records the call.

◆ _wlmaker_xdg_toplevel_fake_set_size()

uint32_t _wlmaker_xdg_toplevel_fake_set_size ( struct wlr_xdg_toplevel *  wlr_xdg_toplevel_ptr,
int32_t  width,
int32_t  height 
)

A fake for wlr_xdg_toplevel_set_size(). Recods the call.

◆ _wlmaker_xdg_toplevel_flush_properties()

void _wlmaker_xdg_toplevel_flush_properties ( struct wlmaker_xdg_toplevel wxt_ptr)
static

Sends pending properties as configure() to the client, after 1st commit.

If the first commit hasn't happened yet, the properties will not be sent. A later call to _wlmaker_xdg_toplevel_flush_properties will then flush them. See wlmaker_xdg_toplevel::pending.

Parameters
wxt_ptr

◆ _wlmaker_xdg_toplevel_handle_destroy()

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

The XDG toplevel is destroyed: Destry the wlmaker toplevel, too.

◆ _wlmaker_xdg_toplevel_handle_new_popup()

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

The XDG toplevel adds a new popup.

◆ _wlmaker_xdg_toplevel_handle_request_fullscreen()

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

The XDG toplevel (client) requests to be put in fullscreen.

◆ _wlmaker_xdg_toplevel_handle_request_maximize()

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

The XDG toplevel requests to be maximized.

◆ _wlmaker_xdg_toplevel_handle_request_minimize()

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

The XDG toplevel requests to be minimized.

◆ _wlmaker_xdg_toplevel_handle_request_move()

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

The XDG toplevel requests to be moved.

◆ _wlmaker_xdg_toplevel_handle_request_resize()

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

The XDG toplevel requests to be resized.

◆ _wlmaker_xdg_toplevel_handle_request_show_window_menu()

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

The XDG toplevel requests to show the window menu.

◆ _wlmaker_xdg_toplevel_handle_set_app_id()

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

The XDG toplevel sets the app ID.

◆ _wlmaker_xdg_toplevel_handle_set_parent()

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

The XDG toplevel sets the parent.

◆ _wlmaker_xdg_toplevel_handle_set_title()

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

The XDG toplevel sets the title.

◆ _wlmaker_xdg_toplevel_handle_surface_commit()

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

Handles XDG surface commits.

◆ _wlmaker_xdg_toplevel_handle_surface_map()

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

Handles the XDG's surface map event.

◆ _wlmaker_xdg_toplevel_handle_surface_unmap()

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

Handles when the XDG surface is to be unmapped.

◆ _wlmaker_xdg_toplevel_handle_window_request_close()

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

Handles the window's request_close event: Forwards to the toplevel.

◆ _wlmaker_xdg_toplevel_handle_window_request_fullscreen()

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

Handles the window's request for going to fullscreen.

◆ _wlmaker_xdg_toplevel_handle_window_request_maximized()

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

Handles the window's request for going to maximized.

◆ _wlmaker_xdg_toplevel_handle_window_request_size()

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

Handles the window's request for size.

◆ _wlmaker_xdg_toplevel_handle_window_set_activated()

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

Handles the window's activation event: Forwards to the toplevel.

◆ _wlmaker_xdg_toplevel_test_activated()

void _wlmaker_xdg_toplevel_test_activated ( bs_test_t *  test_ptr)
static

Tests set_activated requests.

◆ _wlmaker_xdg_toplevel_test_fullscreen()

void _wlmaker_xdg_toplevel_test_fullscreen ( bs_test_t *  test_ptr)
static

Tests fullscreen requests, from client & window.

◆ _wlmaker_xdg_toplevel_test_maximize()

void _wlmaker_xdg_toplevel_test_maximize ( bs_test_t *  test_ptr)
static

Tests maximize requests, from client & window.

◆ _wlmaker_xdg_toplevel_test_setup()

void * _wlmaker_xdg_toplevel_test_setup ( void  )
static

Creates a _xdg_toplevel_test_data in the test context.

◆ _wlmaker_xdg_toplevel_test_size()

void _wlmaker_xdg_toplevel_test_size ( bs_test_t *  test_ptr)
static

Tests set_size requests.

◆ _wlmaker_xdg_toplevel_test_teardown()

void _wlmaker_xdg_toplevel_test_teardown ( void *  test_context_ptr)
static

Tear down XDG toplevel data.

◆ wlmaker_xdg_toplevel_create()

struct wlmaker_xdg_toplevel * wlmaker_xdg_toplevel_create ( struct wlr_xdg_toplevel *  wlr_xdg_toplevel_ptr,
wlmaker_server_t server_ptr 
)

Creates an XDG toplevel.

Parameters
wlr_xdg_toplevel_ptr
server_ptr
Returns
wlmaker's toplevel handle or NULL on error.

◆ wlmaker_xdg_toplevel_destroy()

void wlmaker_xdg_toplevel_destroy ( struct wlmaker_xdg_toplevel wlmaker_xdg_toplevel_ptr)

Dtor for the XDG toplevel.

◆ wlmaker_xdg_toplevel_set_server_side_decorated()

void wlmaker_xdg_toplevel_set_server_side_decorated ( struct wlmaker_xdg_toplevel wlmaker_xdg_toplevel_ptr,
bool  server_side_decorated 
)

En-/Disables server-side decoration for the XDG toplevel.

Variable Documentation

◆ _test_cases

const bs_test_case_t _test_cases[]
Initial value:
= {
{ true, "maximize", _wlmaker_xdg_toplevel_test_maximize },
{ true, "fullscreen", _wlmaker_xdg_toplevel_test_fullscreen },
{ true, "activated", _wlmaker_xdg_toplevel_test_activated },
}
static void _wlmaker_xdg_toplevel_test_activated(bs_test_t *test_ptr)
Definition xdg_toplevel.c:1180
static void _wlmaker_xdg_toplevel_test_size(bs_test_t *test_ptr)
Definition xdg_toplevel.c:1147
static void _wlmaker_xdg_toplevel_test_fullscreen(bs_test_t *test_ptr)
Definition xdg_toplevel.c:1105
static void _wlmaker_xdg_toplevel_test_maximize(bs_test_t *test_ptr)
Definition xdg_toplevel.c:1045

Unit test cases.

◆ wlmaker_xdg_toplevel_test_set

const bs_test_set_t wlmaker_xdg_toplevel_test_set
Initial value:
= BS_TEST_SET_CONTEXT(
true,
"xdg_toplevel",
static void _wlmaker_xdg_toplevel_test_teardown(void *test_context_ptr)
Definition xdg_toplevel.c:1028
static void * _wlmaker_xdg_toplevel_test_setup(void)
Definition xdg_toplevel.c:969
const bs_test_case_t _test_cases[]
Definition xdg_toplevel.c:952

Unit test set.