mirror of
https://github.com/labwc/labwc.git
synced 2025-11-05 13:29:58 -05:00
ssd: Allocate struct ssd and struct ssd_hover_state separately
- Store a pointer to the `struct view` in `struct ssd` - Pass `struct ssd *` instead of `struct view *` to ssd functions - Add `ssd_get_margin()` convenience function
This commit is contained in:
parent
cfa51ab628
commit
1e8b0414fe
15 changed files with 112 additions and 65 deletions
|
|
@ -50,7 +50,6 @@
|
|||
#include "cursor.h"
|
||||
#include "config/keybind.h"
|
||||
#include "config/rcxml.h"
|
||||
#include "ssd.h"
|
||||
#if HAVE_NLS
|
||||
#include <libintl.h>
|
||||
#include <locale.h>
|
||||
|
|
@ -232,7 +231,7 @@ struct server {
|
|||
|
||||
/* SSD state */
|
||||
struct view *focused_view;
|
||||
struct ssd_hover_state ssd_hover_state;
|
||||
struct ssd_hover_state *ssd_hover_state;
|
||||
|
||||
/* Tree for all non-layer xdg/xwayland-shell surfaces */
|
||||
struct wlr_scene_tree *view_tree;
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ struct ssd_state_title_width {
|
|||
};
|
||||
|
||||
struct ssd {
|
||||
struct view *view;
|
||||
struct wlr_scene_tree *tree;
|
||||
|
||||
/*
|
||||
|
|
@ -144,12 +145,23 @@ struct ssd_hover_state {
|
|||
struct wlr_scene_node *node;
|
||||
};
|
||||
|
||||
/* Public SSD API */
|
||||
void ssd_create(struct view *view, bool active);
|
||||
void ssd_set_active(struct view *view, bool active);
|
||||
void ssd_update_title(struct view *view);
|
||||
void ssd_update_geometry(struct view *view);
|
||||
void ssd_destroy(struct view *view);
|
||||
/*
|
||||
* Public SSD API
|
||||
*
|
||||
* For convenience in dealing with non-SSD views, this API allows NULL
|
||||
* ssd/button/node arguments and attempts to do something sensible in
|
||||
* that case (e.g. no-op/return default values).
|
||||
*
|
||||
* NULL scene/view arguments are not allowed.
|
||||
*/
|
||||
struct ssd *ssd_create(struct view *view, bool active);
|
||||
struct border ssd_get_margin(const struct ssd *ssd);
|
||||
void ssd_set_active(struct ssd *ssd, bool active);
|
||||
void ssd_update_title(struct ssd *ssd);
|
||||
void ssd_update_geometry(struct ssd *ssd);
|
||||
void ssd_destroy(struct ssd *ssd);
|
||||
|
||||
struct ssd_hover_state *ssd_hover_state_new(void);
|
||||
void ssd_update_button_hover(struct wlr_scene_node *node,
|
||||
struct ssd_hover_state *hover_state);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <stdint.h>
|
||||
#include <wayland-util.h>
|
||||
#include <wlr/util/box.h>
|
||||
#include "ssd.h"
|
||||
|
||||
/*
|
||||
* In labwc, a view is a container for surfaces which can be moved around by
|
||||
|
|
@ -21,6 +20,7 @@ enum view_type {
|
|||
#endif
|
||||
};
|
||||
|
||||
struct view;
|
||||
struct view_impl {
|
||||
void (*configure)(struct view *view, struct wlr_box geo);
|
||||
void (*close)(struct view *view);
|
||||
|
|
@ -65,7 +65,7 @@ struct view {
|
|||
uint32_t configure_serial;
|
||||
} pending_move_resize;
|
||||
|
||||
struct ssd ssd;
|
||||
struct ssd *ssd;
|
||||
|
||||
struct wlr_foreign_toplevel_handle_v1 *toplevel_handle;
|
||||
struct wl_listener toplevel_handle_request_maximize;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue