wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
icon_manager.c File Reference
#include "icon_manager.h"
#include <inttypes.h>
#include <libbase/libbase.h>
#include <stdbool.h>
#include <stdlib.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_xdg_shell.h>
#include "config.h"
#include "toolkit/toolkit.h"
#include "wlmaker-icon-unstable-v1-server-protocol.h"
#include "xdg_shell.h"
Include dependency graph for icon_manager.c:

Classes

struct  _wlmaker_icon_manager_t
 
struct  _wlmaker_toplevel_icon_t
 

Functions

static wlmaker_icon_manager_ticon_manager_from_resource (struct wl_resource *wl_resource_ptr)
 
static wlmaker_toplevel_icon_twlmaker_toplevel_icon_from_resource (struct wl_resource *wl_resource_ptr)
 
static void bind_icon_manager (struct wl_client *wl_client_ptr, void *data_ptr, uint32_t version, uint32_t id)
 
static void handle_resource_destroy (struct wl_client *wl_client_ptr, struct wl_resource *wl_resource_ptr)
 
static void handle_get_toplevel_icon (struct wl_client *wl_client_ptr, struct wl_resource *wl_icon_manager_resource_ptr, uint32_t id, struct wl_resource *wl_toplevel_resource_ptr, struct wl_resource *wl_surface_resource_ptr)
 
static wlmaker_toplevel_icon_twlmaker_toplevel_icon_create (struct wl_client *wl_client_ptr, wlmaker_icon_manager_t *icon_manager_ptr, uint32_t id, int version, struct wlr_xdg_toplevel *wlr_xdg_toplevel_ptr, struct wlr_surface *wlr_surface_ptr)
 
static void wlmaker_toplevel_icon_destroy (wlmaker_toplevel_icon_t *toplevel_icon_ptr)
 
static void toplevel_icon_resource_destroy (struct wl_resource *wl_resource_ptr)
 
static void handle_icon_ack_configure (struct wl_client *wl_client_ptr, struct wl_resource *wl_resource_ptr, uint32_t serial)
 
static void handle_surface_commit (struct wl_listener *listener_ptr, void *data_ptr)
 
static void handle_surface_destroy (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_toplevel_icon_element_destroy (wlmtk_element_t *element_ptr)
 
wlmaker_icon_manager_twlmaker_icon_manager_create (struct wl_display *wl_display_ptr, wlmaker_server_t *server_ptr)
 
void wlmaker_icon_manager_destroy (wlmaker_icon_manager_t *icon_manager_ptr)
 

Variables

static const struct zwlmaker_icon_manager_v1_interface icon_manager_v1_implementation
 
static const struct zwlmaker_toplevel_icon_v1_interface toplevel_icon_v1_implementation
 
static const wlmtk_element_vmt_t _wlmaker_toplevel_icon_element_vmt
 

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_toplevel_icon_element_destroy()

void _wlmaker_toplevel_icon_element_destroy ( wlmtk_element_t element_ptr)
static

Destructor of the icon's corresponding tile element.

This is a hack: The wlmaker_toplevel_icon_t is owned by the wl_resource and must only be freed when that dtor is caller. But, the element dtor may be called on wlmaker shutdown, when eg. an icon app is still running. So, for that case, we just detach the icon here.

Leaving as is, since the icon model will need to be revamped anyway, to line up with the new XDG icon protocol.

Parameters
element_ptr

◆ bind_icon_manager()

void bind_icon_manager ( struct wl_client *  wl_client_ptr,
void *  data_ptr,
uint32_t  version,
uint32_t  id 
)
static

Binds an icon manager for the client.

Parameters
wl_client_ptr
data_ptr
version
id

◆ handle_get_toplevel_icon()

void handle_get_toplevel_icon ( struct wl_client *  wl_client_ptr,
struct wl_resource *  wl_icon_manager_resource_ptr,
uint32_t  id,
struct wl_resource *  wl_toplevel_resource_ptr,
struct wl_resource *  wl_surface_resource_ptr 
)
static

Handler for the 'get_toplevel_icon' method.

Parameters
wl_client_ptr
wl_icon_manager_resource_ptr
id
wl_toplevel_resource_ptr
wl_surface_resource_ptr

◆ handle_icon_ack_configure()

void handle_icon_ack_configure ( struct wl_client *  wl_client_ptr,
struct wl_resource *  wl_resource_ptr,
uint32_t  serial 
)
static

Handles the ack_configure request by the icon.

Parameters
wl_client_ptr
wl_resource_ptr
serial

◆ handle_resource_destroy()

void handle_resource_destroy ( struct wl_client *  wl_client_ptr,
struct wl_resource *  wl_resource_ptr 
)
static

Handler for the 'destroy' method: Destroys the resource.

Parameters
wl_client_ptr
wl_resource_ptr

◆ handle_surface_commit()

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

Event handler for the commit signal of the icon's surface.

The protocol expects a first commit with a NULL-buffer attached to the surface. This will trigger a configure event, informing the client of the suggested icon size.

Only when the configuration was suggested and acknowledged a first time, will we accept commit with attached buffers.

Parameters
listener_ptr
data_ptrPoints to the struct wlr_surface of the icon.

◆ handle_surface_destroy()

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

Handles when the surface is destroyed.

◆ icon_manager_from_resource()

wlmaker_icon_manager_t * icon_manager_from_resource ( struct wl_resource *  wl_resource_ptr)
static

Returns the toplevel icon manager from the resource, with type check.

Parameters
wl_resource_ptr
Returns
Pointer to the wlmaker_icon_manager_t.

◆ toplevel_icon_resource_destroy()

void toplevel_icon_resource_destroy ( struct wl_resource *  wl_resource_ptr)
static

Destructor for the toplevel icon's resource.

Parameters
wl_resource_ptr

◆ wlmaker_icon_manager_create()

wlmaker_icon_manager_t * wlmaker_icon_manager_create ( struct wl_display *  wl_display_ptr,
wlmaker_server_t server_ptr 
)

Creates an icon manager.

Parameters
wl_display_ptr
server_ptr
Returns
The handle of the icon manager or NULL on error. Must be destroyed by calling wlmaker_icon_manager_destroy.

◆ wlmaker_icon_manager_destroy()

void wlmaker_icon_manager_destroy ( wlmaker_icon_manager_t icon_manager_ptr)

Destroys the Icon Manager.

Parameters
icon_manager_ptr

◆ wlmaker_toplevel_icon_create()

wlmaker_toplevel_icon_t * wlmaker_toplevel_icon_create ( struct wl_client *  wl_client_ptr,
wlmaker_icon_manager_t icon_manager_ptr,
uint32_t  id,
int  version,
struct wlr_xdg_toplevel *  wlr_xdg_toplevel_ptr,
struct wlr_surface *  wlr_surface_ptr 
)
static

Creates a new toplevel icon.

Parameters
wl_client_ptr
icon_manager_ptr
id
version
wlr_xdg_toplevel_ptr
wlr_surface_ptr
Returns
A pointer to the new toplevel icon or NULL on error. The toplevel icon's resources must be free'd via wlmaker_toplevel_icon_destroy.

◆ wlmaker_toplevel_icon_destroy()

void wlmaker_toplevel_icon_destroy ( wlmaker_toplevel_icon_t toplevel_icon_ptr)
static

Destroys the toplevel icon.

Parameters
toplevel_icon_ptr

◆ wlmaker_toplevel_icon_from_resource()

wlmaker_toplevel_icon_t * wlmaker_toplevel_icon_from_resource ( struct wl_resource *  wl_resource_ptr)
static

Returns the toplevel icon from the resource, with type check.

Parameters
wl_resource_ptr
Returns
Pointer to the wlmaker_toplevel_icon_t.

Variable Documentation

◆ _wlmaker_toplevel_icon_element_vmt

const wlmtk_element_vmt_t _wlmaker_toplevel_icon_element_vmt
static
Initial value:
= {
}
static void _wlmaker_toplevel_icon_element_destroy(wlmtk_element_t *element_ptr)
Definition icon_manager.c:549

The icon's extension to wlmtk_element_t virtual method table.

◆ icon_manager_v1_implementation

const struct zwlmaker_icon_manager_v1_interface icon_manager_v1_implementation
static
Initial value:
= {
.get_toplevel_icon = handle_get_toplevel_icon
}
static void handle_resource_destroy(struct wl_client *wl_client_ptr, struct wl_resource *wl_resource_ptr)
Definition icon_manager.c:272
static void handle_get_toplevel_icon(struct wl_client *wl_client_ptr, struct wl_resource *wl_icon_manager_resource_ptr, uint32_t id, struct wl_resource *wl_toplevel_resource_ptr, struct wl_resource *wl_surface_resource_ptr)
Definition icon_manager.c:289

Implementation of the toplevel icon manager interface.

◆ toplevel_icon_v1_implementation

const struct zwlmaker_toplevel_icon_v1_interface toplevel_icon_v1_implementation
static
Initial value:
= {
.ack_configure = handle_icon_ack_configure,
}
static void handle_icon_ack_configure(struct wl_client *wl_client_ptr, struct wl_resource *wl_resource_ptr, uint32_t serial)
Definition icon_manager.c:459

Implementation of the toplevel icon interface.