mirror of
https://github.com/labwc/labwc.git
synced 2026-06-13 14:33:18 -04:00
add config dialog
This commit is contained in:
parent
ff2f243eb1
commit
c8889c7fb7
12 changed files with 230 additions and 59 deletions
|
|
@ -50,6 +50,7 @@ enum lab_node_type {
|
|||
LAB_NODE_CYCLE_OSD_ITEM,
|
||||
LAB_NODE_LAYER_SURFACE,
|
||||
LAB_NODE_UNMANAGED,
|
||||
LAB_NODE_CONFIG_DIALOG,
|
||||
LAB_NODE_ALL,
|
||||
|
||||
/* translated to LAB_NODE_CLIENT by get_cursor_context() */
|
||||
|
|
|
|||
23
include/config/dialog.h
Normal file
23
include/config/dialog.h
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LAB_DIALOG_H
|
||||
#define LAB_DIALOG_H
|
||||
|
||||
struct wlr_scene_node;
|
||||
|
||||
/**
|
||||
* dialog_create_callback - creates the config dialog,
|
||||
* used with wl_event_loop_add_idle.
|
||||
*
|
||||
* @data: Ignored.
|
||||
*/
|
||||
void dialog_create_callback(void *data);
|
||||
|
||||
/**
|
||||
* dialog_destroy - destroys a dialog that is a child of
|
||||
* server.dialog_tree, destroys all children if NULL is provided.
|
||||
*
|
||||
* @dialog: Dialog to be destroyed
|
||||
*/
|
||||
void dialog_destroy(struct wlr_scene_node *dialog);
|
||||
|
||||
#endif /* LAB_DIALOG_H */
|
||||
|
|
@ -17,6 +17,28 @@
|
|||
/* max of one button of each type (no repeats) */
|
||||
#define TITLE_BUTTONS_MAX ((LAB_NODE_BUTTON_LAST + 1) - LAB_NODE_BUTTON_FIRST)
|
||||
|
||||
struct log_item {
|
||||
char *text;
|
||||
struct wl_list link; /* struct rcxml.error_logs */
|
||||
};
|
||||
|
||||
/**
|
||||
* Calls wlr_log(verb, fmt, ...) and also saves it in
|
||||
* rc.error_logs for displaying it in a dialog later.
|
||||
* Only sets rc.has_error when WLR_ERROR is used to log
|
||||
* other relevant info like the config file.
|
||||
*/
|
||||
#define lab_wlr_log(verb, fmt, ...) \
|
||||
do { \
|
||||
wlr_log(verb, fmt, ##__VA_ARGS__); \
|
||||
if (verb == WLR_ERROR) { \
|
||||
rc.has_error = true; \
|
||||
} \
|
||||
struct log_item *log_item = znew(*log_item); \
|
||||
log_item->text = strdup_printf(fmt, ##__VA_ARGS__); \
|
||||
wl_list_append(&rc.error_logs, &log_item->link); \
|
||||
} while (0)
|
||||
|
||||
enum adaptive_sync_mode {
|
||||
LAB_ADAPTIVE_SYNC_DISABLED,
|
||||
LAB_ADAPTIVE_SYNC_ENABLED,
|
||||
|
|
@ -213,6 +235,10 @@ struct rcxml {
|
|||
float mag_scale;
|
||||
float mag_increment;
|
||||
bool mag_filter;
|
||||
|
||||
/* Error log */
|
||||
bool has_error;
|
||||
struct wl_list error_logs; /* struct log_item.link */
|
||||
};
|
||||
|
||||
/* defined in main.c */
|
||||
|
|
|
|||
|
|
@ -230,6 +230,9 @@ struct server {
|
|||
/* Tree for all non-layer xdg/xwayland-shell surfaces */
|
||||
struct wlr_scene_tree *workspace_tree;
|
||||
|
||||
/* Tree for error dialog */
|
||||
struct wlr_scene_tree *dialog_tree;
|
||||
|
||||
/*
|
||||
* Popups need to be rendered above always-on-top views, so we reparent
|
||||
* them to this dedicated tree
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue