wlmaker
Loading...
Searching...
No Matches
Classes | Macros | Functions | Variables
task_list.c File Reference
#include "task_list.h"
#include <cairo.h>
#include <inttypes.h>
#include <libbase/libbase.h>
#include <libbase/plist.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <wayland-server-core.h>
#include <wlr/util/edges.h>
#include <wlr/interfaces/wlr_buffer.h>
#include "config.h"
#include "server.h"
#include "toolkit/toolkit.h"
Include dependency graph for task_list.c:

Classes

struct  _wlmaker_task_list_t
 

Macros

#define _POSIX_C_SOURCE   1
 for PATH_MAX.
 
#define WLR_USE_UNSTABLE
 Include unstable interfaces of wlroots.
 

Functions

static bool _wlmaker_task_list_refresh (wlmaker_task_list_t *task_list_ptr, const struct wlmaker_task_list_style *style_ptr)
 
static struct wlr_buffer * create_wlr_buffer (wlmtk_workspace_t *workspace_ptr, const struct wlmaker_task_list_style *style_ptr)
 
static void _wlmaker_task_list_draw_into_cairo (cairo_t *cairo_ptr, const struct wlmaker_task_list_style *style_ptr, wlmtk_workspace_t *workspace_ptr)
 
static void _wlmaker_task_list_draw_window_into_cairo (cairo_t *cairo_ptr, const wlmtk_style_font_t *font_style_ptr, uint32_t color, wlmtk_window_t *window_ptr, bool active, int pos_y)
 
static const char * _wlmaker_task_list_window_name (wlmtk_window_t *window_ptr)
 
static uint32_t _wlmaker_task_list_request_size (wlmtk_panel_t *panel_ptr, int width, int height)
 
static void _wlmaker_task_list_handle_task_list_enabled (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_task_list_handle_task_list_disabled (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_task_list_handle_theme_changed (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_task_list_handle_window_mapped (struct wl_listener *listener_ptr, void *data_ptr)
 
static void _wlmaker_task_list_handle_window_unmapped (struct wl_listener *listener_ptr, void *data_ptr)
 
wlmaker_task_list_twlmaker_task_list_create (wlmaker_server_t *server_ptr, const struct wlmaker_task_list_style *style_ptr)
 
void wlmaker_task_list_destroy (wlmaker_task_list_t *task_list_ptr)
 

Variables

const bspl_desc_t wlmaker_task_list_style_desc []
 
static const wlmtk_panel_positioning_t _wlmaker_task_list_positioning
 
static const wlmtk_panel_vmt_t _wlmaker_task_list_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_task_list_draw_into_cairo()

void _wlmaker_task_list_draw_into_cairo ( cairo_t *  cairo_ptr,
const struct wlmaker_task_list_style style_ptr,
wlmtk_workspace_t workspace_ptr 
)
static

Draws all tasks of workspace_ptr into cairo_ptr.

Parameters
cairo_ptr
style_ptr
workspace_ptr

◆ _wlmaker_task_list_draw_window_into_cairo()

void _wlmaker_task_list_draw_window_into_cairo ( cairo_t *  cairo_ptr,
const wlmtk_style_font_t font_style_ptr,
uint32_t  color,
wlmtk_window_t window_ptr,
bool  active,
int  pos_y 
)
static

Draws one window (task) into cairo_ptr.

Parameters
cairo_ptr
font_style_ptr
color
window_ptr
activeWhether this window is currently active.
pos_yY position within the cairo_ptr.

◆ _wlmaker_task_list_handle_task_list_disabled()

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

Handler for the task_list_disabled_listener: Hides the list.

Parameters
listener_ptr
data_ptr

◆ _wlmaker_task_list_handle_task_list_enabled()

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

Handler for the task_list_enabled_listener.

Enables the task listener: Creates the task list for the currently-active workspace and enables the task list on that workspace.

Parameters
listener_ptr
data_ptr

◆ _wlmaker_task_list_handle_theme_changed()

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

Handler for the theme_changed_listener: Updates the style

Parameters
listener_ptr
data_ptr

◆ _wlmaker_task_list_handle_window_mapped()

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

Handler for the window_mapped_listener: Refreshes the list (if enabled).

Parameters
listener_ptr
data_ptr

◆ _wlmaker_task_list_handle_window_unmapped()

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

Handler for the window_unmapped_listener: Refreshes the list (if enabled).

Parameters
listener_ptr
data_ptr

◆ _wlmaker_task_list_refresh()

bool _wlmaker_task_list_refresh ( wlmaker_task_list_t task_list_ptr,
const struct wlmaker_task_list_style style_ptr 
)
static

Refreshes the task list. Should be done whenever a list is mapped/unmapped.

Parameters
task_list_ptr
style_ptr
Returns
true on success.

◆ _wlmaker_task_list_request_size()

uint32_t _wlmaker_task_list_request_size ( wlmtk_panel_t panel_ptr,
int  width,
int  height 
)
static

Implements wlmtk_panel_vmt_t::request_size.

Parameters
panel_ptr
width
height
Returns
0 always.

◆ _wlmaker_task_list_window_name()

const char * _wlmaker_task_list_window_name ( wlmtk_window_t window_ptr)
static

Constructs a comprehensive name for the window.

Parameters
window_ptr
Returns
Pointer to the constructed name. This is a static buffer that does not require to be free'd, but will be re-used upon next call to window_name.

◆ create_wlr_buffer()

struct wlr_buffer * create_wlr_buffer ( wlmtk_workspace_t workspace_ptr,
const struct wlmaker_task_list_style style_ptr 
)
static

Creates a struct wlr_buffer with windows of workspace_ptr drawn into.

Parameters
workspace_ptr
style_ptr
Returns
A pointer to the struct wlr_buffer with the list of windows (tasks), or NULL on error.

◆ wlmaker_task_list_create()

wlmaker_task_list_t * wlmaker_task_list_create ( wlmaker_server_t server_ptr,
const struct wlmaker_task_list_style style_ptr 
)

Creates a task list for the server.

Will allocate the task list handle, and register signal handlers so the task list reacts to task_list_enabled_event and task_list_disabled_event of the wlmaker_server_t.

Parameters
server_ptr
style_ptr
Returns
The task list handle or NULL on error. Must be released by calling wlmaker_task_list_destroy.

◆ wlmaker_task_list_destroy()

void wlmaker_task_list_destroy ( wlmaker_task_list_t task_list_ptr)

Destroys the task list, as created by wlmaker_task_list_create.

Parameters
task_list_ptr

Variable Documentation

◆ _wlmaker_task_list_positioning

const wlmtk_panel_positioning_t _wlmaker_task_list_positioning
static
Initial value:
= {
.desired_width = 400,
.desired_height = 200,
.anchor = WLR_EDGE_BOTTOM | WLR_EDGE_TOP | WLR_EDGE_LEFT | WLR_EDGE_RIGHT
}

Task list positioning: Fixed dimensions, at center of layer.

◆ _wlmaker_task_list_vmt

const wlmtk_panel_vmt_t _wlmaker_task_list_vmt
static
Initial value:
= {
}
static uint32_t _wlmaker_task_list_request_size(wlmtk_panel_t *panel_ptr, int width, int height)
Definition task_list.c:434

Virtual method table for the task list.

◆ wlmaker_task_list_style_desc

const bspl_desc_t wlmaker_task_list_style_desc[]
Initial value:
= {
BSPL_DESC_CUSTOM(
"Fill", true, struct wlmaker_task_list_style, fill, fill,
wlmtk_style_decode_fill, NULL, NULL, NULL),
BSPL_DESC_DICT(
"Font", true, struct wlmaker_task_list_style, font, font,
BSPL_DESC_ARGB32(
"TextColor", true, struct wlmaker_task_list_style,
text_color, text_color, 0),
}
Definition task_list.h:35
const bspl_desc_t wlmtk_style_font_desc[]
Definition style.c:44
bool wlmtk_style_decode_fill(bspl_object_t *object_ptr, const union bspl_desc_value *desc_value_ptr, void *value_ptr)
Definition style.c:107

Descriptor for decoding the "TaskList" dictionary.