mirror of
https://github.com/labwc/labwc.git
synced 2026-03-04 01:40:39 -05:00
include: add config/types.h
This commit is contained in:
parent
6dea8c0dcc
commit
9d49d19cd2
54 changed files with 414 additions and 368 deletions
|
|
@ -3,9 +3,9 @@
|
||||||
#define LABWC_DIRECTION_H
|
#define LABWC_DIRECTION_H
|
||||||
|
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
#include "view.h"
|
#include "config/types.h"
|
||||||
|
|
||||||
bool direction_from_view_edge(enum view_edge edge, enum wlr_direction *direction);
|
bool direction_from_edge(enum lab_edge edge, enum wlr_direction *direction);
|
||||||
enum wlr_direction direction_get_opposite(enum wlr_direction direction);
|
enum wlr_direction direction_get_opposite(enum wlr_direction direction);
|
||||||
|
|
||||||
#endif /* LABWC_DIRECTION_H */
|
#endif /* LABWC_DIRECTION_H */
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,18 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
#ifndef LABWC_PARSE_BOOL_H
|
#ifndef LABWC_PARSE_BOOL_H
|
||||||
#define LABWC_PARSE_BOOL_H
|
#define LABWC_PARSE_BOOL_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "common/three-state.h"
|
#include "config/types.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse_three_state() - Parse boolean value of string as a three-state enum.
|
* parse_tristate() - Parse boolean value of string as a three-state enum.
|
||||||
* @string: String to interpret. This check is case-insensitive.
|
* @string: String to interpret. This check is case-insensitive.
|
||||||
*
|
*
|
||||||
* Return: LAB_STATE_DISABLED for false; LAB_STATE_ENABLED for true;
|
* Return: LAB_STATE_DISABLED for false; LAB_STATE_ENABLED for true;
|
||||||
* LAB_STATE_UNSPECIFIED for non-boolean
|
* LAB_STATE_UNSPECIFIED for non-boolean
|
||||||
*/
|
*/
|
||||||
enum three_state parse_three_state(const char *str);
|
enum lab_tristate parse_tristate(const char *str);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* parse_bool() - Parse boolean value of string.
|
* parse_bool() - Parse boolean value of string.
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
#ifndef LABWC_THREE_STATE_H
|
|
||||||
#define LABWC_THREE_STATE_H
|
|
||||||
|
|
||||||
enum three_state {
|
|
||||||
LAB_STATE_UNSPECIFIED = 0,
|
|
||||||
LAB_STATE_ENABLED,
|
|
||||||
LAB_STATE_DISABLED
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* LABWC_THREE_STATE_H */
|
|
||||||
|
|
@ -3,29 +3,17 @@
|
||||||
#define LABWC_RCXML_H
|
#define LABWC_RCXML_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
|
#include <wlr/util/box.h>
|
||||||
#include <libxml/tree.h>
|
#include <libxml/tree.h>
|
||||||
|
|
||||||
#include "common/border.h"
|
#include "common/border.h"
|
||||||
#include "common/buf.h"
|
#include "common/buf.h"
|
||||||
#include "common/font.h"
|
#include "common/font.h"
|
||||||
#include "common/three-state.h"
|
#include "config/types.h"
|
||||||
#include "config/touch.h"
|
|
||||||
#include "config/tablet.h"
|
|
||||||
#include "config/tablet-tool.h"
|
|
||||||
#include "config/libinput.h"
|
|
||||||
#include "resize-indicator.h"
|
|
||||||
#include "ssd.h"
|
#include "ssd.h"
|
||||||
#include "theme.h"
|
|
||||||
|
|
||||||
enum view_placement_policy {
|
#define BUTTON_MAP_MAX 16
|
||||||
LAB_PLACE_INVALID = 0,
|
|
||||||
LAB_PLACE_CENTER,
|
|
||||||
LAB_PLACE_CURSOR,
|
|
||||||
LAB_PLACE_AUTOMATIC,
|
|
||||||
LAB_PLACE_CASCADE,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum adaptive_sync_mode {
|
enum adaptive_sync_mode {
|
||||||
LAB_ADAPTIVE_SYNC_DISABLED,
|
LAB_ADAPTIVE_SYNC_DISABLED,
|
||||||
|
|
@ -33,6 +21,12 @@ enum adaptive_sync_mode {
|
||||||
LAB_ADAPTIVE_SYNC_FULLSCREEN,
|
LAB_ADAPTIVE_SYNC_FULLSCREEN,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum resize_indicator_mode {
|
||||||
|
LAB_RESIZE_INDICATOR_NEVER = 0,
|
||||||
|
LAB_RESIZE_INDICATOR_ALWAYS,
|
||||||
|
LAB_RESIZE_INDICATOR_NON_PIXEL
|
||||||
|
};
|
||||||
|
|
||||||
enum tearing_mode {
|
enum tearing_mode {
|
||||||
LAB_TEARING_DISABLED = 0,
|
LAB_TEARING_DISABLED = 0,
|
||||||
LAB_TEARING_ENABLED,
|
LAB_TEARING_ENABLED,
|
||||||
|
|
@ -48,6 +42,11 @@ enum tiling_events_mode {
|
||||||
(LAB_TILING_EVENTS_REGION | LAB_TILING_EVENTS_EDGE),
|
(LAB_TILING_EVENTS_REGION | LAB_TILING_EVENTS_EDGE),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct button_map_entry {
|
||||||
|
uint32_t from;
|
||||||
|
uint32_t to;
|
||||||
|
};
|
||||||
|
|
||||||
struct title_button {
|
struct title_button {
|
||||||
enum ssd_part_type type;
|
enum ssd_part_type type;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
@ -72,7 +71,7 @@ struct rcxml {
|
||||||
enum tearing_mode allow_tearing;
|
enum tearing_mode allow_tearing;
|
||||||
bool auto_enable_outputs;
|
bool auto_enable_outputs;
|
||||||
bool reuse_output_mode;
|
bool reuse_output_mode;
|
||||||
enum view_placement_policy placement_policy;
|
enum lab_placement_policy placement_policy;
|
||||||
bool xwayland_persistence;
|
bool xwayland_persistence;
|
||||||
bool primary_selection;
|
bool primary_selection;
|
||||||
int placement_cascade_offset_x;
|
int placement_cascade_offset_x;
|
||||||
|
|
@ -110,7 +109,7 @@ struct rcxml {
|
||||||
/* keyboard */
|
/* keyboard */
|
||||||
int repeat_rate;
|
int repeat_rate;
|
||||||
int repeat_delay;
|
int repeat_delay;
|
||||||
enum three_state kb_numlock_enable;
|
enum lab_tristate kb_numlock_enable;
|
||||||
bool kb_layout_per_window;
|
bool kb_layout_per_window;
|
||||||
struct wl_list keybinds; /* struct keybind.link */
|
struct wl_list keybinds; /* struct keybind.link */
|
||||||
|
|
||||||
|
|
@ -126,12 +125,12 @@ struct rcxml {
|
||||||
bool force_mouse_emulation;
|
bool force_mouse_emulation;
|
||||||
char *output_name;
|
char *output_name;
|
||||||
struct wlr_fbox box;
|
struct wlr_fbox box;
|
||||||
enum rotation rotation;
|
enum lab_rotation rotation;
|
||||||
uint16_t button_map_count;
|
uint16_t button_map_count;
|
||||||
struct button_map_entry button_map[BUTTON_MAP_MAX];
|
struct button_map_entry button_map[BUTTON_MAP_MAX];
|
||||||
} tablet;
|
} tablet;
|
||||||
struct tablet_tool_config {
|
struct tablet_tool_config {
|
||||||
enum motion motion;
|
enum lab_motion motion;
|
||||||
double relative_motion_sensitivity;
|
double relative_motion_sensitivity;
|
||||||
} tablet_tool;
|
} tablet_tool;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,8 @@
|
||||||
#ifndef LABWC_TABLET_TOOL_CONFIG_H
|
#ifndef LABWC_TABLET_TOOL_CONFIG_H
|
||||||
#define LABWC_TABLET_TOOL_CONFIG_H
|
#define LABWC_TABLET_TOOL_CONFIG_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include "config/types.h"
|
||||||
|
|
||||||
enum motion {
|
enum lab_motion tablet_parse_motion(const char *name);
|
||||||
LAB_TABLET_MOTION_ABSOLUTE = 0,
|
|
||||||
LAB_TABLET_MOTION_RELATIVE,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum motion tablet_parse_motion(const char *name);
|
|
||||||
|
|
||||||
#endif /* LABWC_TABLET_TOOL_CONFIG_H */
|
#endif /* LABWC_TABLET_TOOL_CONFIG_H */
|
||||||
|
|
|
||||||
|
|
@ -3,22 +3,10 @@
|
||||||
#define LABWC_TABLET_CONFIG_H
|
#define LABWC_TABLET_CONFIG_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include "config/types.h"
|
||||||
enum rotation {
|
|
||||||
LAB_ROTATE_NONE = 0,
|
|
||||||
LAB_ROTATE_90,
|
|
||||||
LAB_ROTATE_180,
|
|
||||||
LAB_ROTATE_270,
|
|
||||||
};
|
|
||||||
|
|
||||||
#define BUTTON_MAP_MAX 16
|
|
||||||
struct button_map_entry {
|
|
||||||
uint32_t from;
|
|
||||||
uint32_t to;
|
|
||||||
};
|
|
||||||
|
|
||||||
double tablet_get_dbl_if_positive(const char *content, const char *name);
|
double tablet_get_dbl_if_positive(const char *content, const char *name);
|
||||||
enum rotation tablet_parse_rotation(int value);
|
enum lab_rotation tablet_parse_rotation(int value);
|
||||||
uint32_t tablet_button_from_str(const char *button);
|
uint32_t tablet_button_from_str(const char *button);
|
||||||
void tablet_button_mapping_add(uint32_t from, uint32_t to);
|
void tablet_button_mapping_add(uint32_t from, uint32_t to);
|
||||||
void tablet_load_default_button_mappings(void);
|
void tablet_load_default_button_mappings(void);
|
||||||
|
|
|
||||||
118
include/config/types.h
Normal file
118
include/config/types.h
Normal file
|
|
@ -0,0 +1,118 @@
|
||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
#ifndef LABWC_CONFIG_TYPES_H
|
||||||
|
#define LABWC_CONFIG_TYPES_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shared (basic) types related to user configuration.
|
||||||
|
*
|
||||||
|
* Please try to keep dependencies on other headers minimal,
|
||||||
|
* since config/types.h gets included in many source files.
|
||||||
|
*
|
||||||
|
* For the full config struct, see config/rcxml.h.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edges to which a view can be snapped. "Any" is used as
|
||||||
|
* a catch-all for every valid edge in order to simplify certain
|
||||||
|
* types of conditionals, but it is only valid for a selection
|
||||||
|
* of options in rc.xml.
|
||||||
|
*/
|
||||||
|
enum lab_edge {
|
||||||
|
LAB_EDGE_INVALID = 0,
|
||||||
|
|
||||||
|
LAB_EDGE_LEFT = (1 << 0),
|
||||||
|
LAB_EDGE_RIGHT = (1 << 1),
|
||||||
|
LAB_EDGE_UP = (1 << 2),
|
||||||
|
LAB_EDGE_DOWN = (1 << 3),
|
||||||
|
LAB_EDGE_CENTER = (1 << 4),
|
||||||
|
LAB_EDGE_ANY = (1 << 5),
|
||||||
|
|
||||||
|
LAB_EDGE_UPLEFT = (LAB_EDGE_UP | LAB_EDGE_LEFT),
|
||||||
|
LAB_EDGE_UPRIGHT = (LAB_EDGE_UP | LAB_EDGE_RIGHT),
|
||||||
|
LAB_EDGE_DOWNLEFT = (LAB_EDGE_DOWN | LAB_EDGE_LEFT),
|
||||||
|
LAB_EDGE_DOWNRIGHT = (LAB_EDGE_DOWN | LAB_EDGE_RIGHT),
|
||||||
|
};
|
||||||
|
|
||||||
|
enum lab_motion {
|
||||||
|
LAB_MOTION_ABSOLUTE = 0,
|
||||||
|
LAB_MOTION_RELATIVE,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum lab_placement_policy {
|
||||||
|
LAB_PLACE_INVALID = 0,
|
||||||
|
LAB_PLACE_CENTER,
|
||||||
|
LAB_PLACE_CURSOR,
|
||||||
|
LAB_PLACE_AUTOMATIC,
|
||||||
|
LAB_PLACE_CASCADE,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum lab_rotation {
|
||||||
|
LAB_ROTATE_NONE = 0,
|
||||||
|
LAB_ROTATE_90,
|
||||||
|
LAB_ROTATE_180,
|
||||||
|
LAB_ROTATE_270,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum lab_ssd_mode {
|
||||||
|
LAB_SSD_MODE_INVALID,
|
||||||
|
LAB_SSD_MODE_NONE,
|
||||||
|
LAB_SSD_MODE_BORDER,
|
||||||
|
LAB_SSD_MODE_FULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum lab_tristate {
|
||||||
|
LAB_STATE_UNSPECIFIED = 0,
|
||||||
|
LAB_STATE_ENABLED,
|
||||||
|
LAB_STATE_DISABLED
|
||||||
|
};
|
||||||
|
|
||||||
|
/* All criteria is applied in AND logic */
|
||||||
|
enum lab_view_criteria {
|
||||||
|
/* No filter -> all focusable views */
|
||||||
|
LAB_VIEW_CRITERIA_NONE = 0,
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Includes always-on-top views, e.g.
|
||||||
|
* what is visible on the current workspace
|
||||||
|
*/
|
||||||
|
LAB_VIEW_CRITERIA_CURRENT_WORKSPACE = 1 << 0,
|
||||||
|
|
||||||
|
/* Positive criteria */
|
||||||
|
LAB_VIEW_CRITERIA_FULLSCREEN = 1 << 1,
|
||||||
|
LAB_VIEW_CRITERIA_ALWAYS_ON_TOP = 1 << 2,
|
||||||
|
LAB_VIEW_CRITERIA_ROOT_TOPLEVEL = 1 << 3,
|
||||||
|
|
||||||
|
/* Negative criteria */
|
||||||
|
LAB_VIEW_CRITERIA_NO_ALWAYS_ON_TOP = 1 << 6,
|
||||||
|
LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER = 1 << 7,
|
||||||
|
LAB_VIEW_CRITERIA_NO_OMNIPRESENT = 1 << 8,
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Window types are based on the NET_WM constants from X11. See:
|
||||||
|
* https://specifications.freedesktop.org/wm-spec/1.4/ar01s05.html#id-1.6.7
|
||||||
|
*
|
||||||
|
* The enum constants are intended to match wlr_xwayland_net_wm_window_type.
|
||||||
|
* Redefining the same constants here may seem redundant, but is necessary
|
||||||
|
* to make them available even in builds with xwayland support disabled.
|
||||||
|
*/
|
||||||
|
enum lab_window_type {
|
||||||
|
LAB_WINDOW_TYPE_DESKTOP = 0,
|
||||||
|
LAB_WINDOW_TYPE_DOCK,
|
||||||
|
LAB_WINDOW_TYPE_TOOLBAR,
|
||||||
|
LAB_WINDOW_TYPE_MENU,
|
||||||
|
LAB_WINDOW_TYPE_UTILITY,
|
||||||
|
LAB_WINDOW_TYPE_SPLASH,
|
||||||
|
LAB_WINDOW_TYPE_DIALOG,
|
||||||
|
LAB_WINDOW_TYPE_DROPDOWN_MENU,
|
||||||
|
LAB_WINDOW_TYPE_POPUP_MENU,
|
||||||
|
LAB_WINDOW_TYPE_TOOLTIP,
|
||||||
|
LAB_WINDOW_TYPE_NOTIFICATION,
|
||||||
|
LAB_WINDOW_TYPE_COMBO,
|
||||||
|
LAB_WINDOW_TYPE_DND,
|
||||||
|
LAB_WINDOW_TYPE_NORMAL,
|
||||||
|
|
||||||
|
LAB_WINDOW_TYPE_LEN
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* LABWC_CONFIG_TYPES_H */
|
||||||
|
|
@ -21,7 +21,7 @@ struct drawing_tablet_tool {
|
||||||
*/
|
*/
|
||||||
bool force_mouse_emulation;
|
bool force_mouse_emulation;
|
||||||
|
|
||||||
enum motion motion_mode;
|
enum lab_motion motion_mode;
|
||||||
double x, y, dx, dy;
|
double x, y, dx, dy;
|
||||||
double distance;
|
double distance;
|
||||||
double pressure;
|
double pressure;
|
||||||
|
|
|
||||||
|
|
@ -434,11 +434,11 @@ void interactive_cancel(struct view *view);
|
||||||
* Returns the edge to snap a window to.
|
* Returns the edge to snap a window to.
|
||||||
* For example, if the output-relative cursor position (x,y) fulfills
|
* For example, if the output-relative cursor position (x,y) fulfills
|
||||||
* x <= (<snapping><cornerRange>) and y <= (<snapping><range>),
|
* x <= (<snapping><cornerRange>) and y <= (<snapping><range>),
|
||||||
* then edge1=VIEW_EDGE_UP and edge2=VIEW_EDGE_LEFT.
|
* then edge1=LAB_EDGE_UP and edge2=LAB_EDGE_LEFT.
|
||||||
* The value of (edge1|edge2) can be passed to view_snap_to_edge().
|
* The value of (edge1|edge2) can be passed to view_snap_to_edge().
|
||||||
*/
|
*/
|
||||||
bool edge_from_cursor(struct seat *seat, struct output **dest_output,
|
bool edge_from_cursor(struct seat *seat, struct output **dest_output,
|
||||||
enum view_edge *edge1, enum view_edge *edge2);
|
enum lab_edge *edge1, enum lab_edge *edge2);
|
||||||
|
|
||||||
void handle_tearing_new_object(struct wl_listener *listener, void *data);
|
void handle_tearing_new_object(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
|
|
||||||
enum view_edge;
|
enum lab_edge;
|
||||||
|
|
||||||
#define LAB_NR_LAYERS (4)
|
#define LAB_NR_LAYERS (4)
|
||||||
|
|
||||||
|
|
@ -60,7 +60,7 @@ struct output *output_nearest_to_cursor(struct server *server);
|
||||||
* reference instead.
|
* reference instead.
|
||||||
*/
|
*/
|
||||||
struct output *output_get_adjacent(struct output *output,
|
struct output *output_get_adjacent(struct output *output,
|
||||||
enum view_edge edge, bool wrap);
|
enum lab_edge edge, bool wrap);
|
||||||
|
|
||||||
bool output_is_usable(struct output *output);
|
bool output_is_usable(struct output *output);
|
||||||
void output_update_usable_area(struct output *output);
|
void output_update_usable_area(struct output *output);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ struct overlay {
|
||||||
struct region *region;
|
struct region *region;
|
||||||
|
|
||||||
/* Snap-to-edge overlay */
|
/* Snap-to-edge overlay */
|
||||||
enum view_edge edge;
|
enum lab_edge edge;
|
||||||
struct output *output;
|
struct output *output;
|
||||||
} active;
|
} active;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,6 @@
|
||||||
struct server;
|
struct server;
|
||||||
struct view;
|
struct view;
|
||||||
|
|
||||||
enum resize_indicator_mode {
|
|
||||||
LAB_RESIZE_INDICATOR_NEVER = 0,
|
|
||||||
LAB_RESIZE_INDICATOR_ALWAYS,
|
|
||||||
LAB_RESIZE_INDICATOR_NON_PIXEL
|
|
||||||
};
|
|
||||||
|
|
||||||
void resize_indicator_reconfigure(struct server *server);
|
void resize_indicator_reconfigure(struct server *server);
|
||||||
void resize_indicator_show(struct view *view);
|
void resize_indicator_show(struct view *view);
|
||||||
void resize_indicator_update(struct view *view);
|
void resize_indicator_update(struct view *view);
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@
|
||||||
struct wlr_box;
|
struct wlr_box;
|
||||||
|
|
||||||
void snap_move_to_edge(struct view *view,
|
void snap_move_to_edge(struct view *view,
|
||||||
enum view_edge direction, bool snap_to_windows, int *dx, int *dy);
|
enum lab_edge direction, bool snap_to_windows, int *dx, int *dy);
|
||||||
|
|
||||||
void snap_grow_to_next_edge(struct view *view,
|
void snap_grow_to_next_edge(struct view *view,
|
||||||
enum view_edge direction, struct wlr_box *geo);
|
enum lab_edge direction, struct wlr_box *geo);
|
||||||
|
|
||||||
void snap_shrink_to_next_edge(struct view *view,
|
void snap_shrink_to_next_edge(struct view *view,
|
||||||
enum view_edge direction, struct wlr_box *geo);
|
enum lab_edge direction, struct wlr_box *geo);
|
||||||
|
|
||||||
void snap_invalidate_edge_cache(struct view *view);
|
void snap_invalidate_edge_cache(struct view *view);
|
||||||
void snap_update_cache_geometry(struct view *view);
|
void snap_update_cache_geometry(struct view *view);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "ssd.h"
|
#include "ssd.h"
|
||||||
|
#include "theme.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
#define FOR_EACH(tmp, ...) \
|
#define FOR_EACH(tmp, ...) \
|
||||||
|
|
|
||||||
|
|
@ -61,13 +61,6 @@ enum ssd_part_type {
|
||||||
LAB_SSD_END_MARKER
|
LAB_SSD_END_MARKER
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ssd_mode {
|
|
||||||
LAB_SSD_MODE_INVALID,
|
|
||||||
LAB_SSD_MODE_NONE,
|
|
||||||
LAB_SSD_MODE_BORDER,
|
|
||||||
LAB_SSD_MODE_FULL,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Forward declare arguments */
|
/* Forward declare arguments */
|
||||||
struct ssd;
|
struct ssd;
|
||||||
struct ssd_button;
|
struct ssd_button;
|
||||||
|
|
@ -110,7 +103,7 @@ enum ssd_part_type ssd_get_part_type(const struct ssd *ssd,
|
||||||
struct wlr_scene_node *node, struct wlr_cursor *cursor);
|
struct wlr_scene_node *node, struct wlr_cursor *cursor);
|
||||||
uint32_t ssd_resize_edges(enum ssd_part_type type);
|
uint32_t ssd_resize_edges(enum ssd_part_type type);
|
||||||
bool ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate);
|
bool ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate);
|
||||||
enum ssd_mode ssd_mode_parse(const char *mode);
|
enum lab_ssd_mode ssd_mode_parse(const char *mode);
|
||||||
|
|
||||||
/* TODO: clean up / update */
|
/* TODO: clean up / update */
|
||||||
struct border ssd_thickness(struct view *view);
|
struct border ssd_thickness(struct view *view);
|
||||||
|
|
|
||||||
124
include/view.h
124
include/view.h
|
|
@ -2,15 +2,13 @@
|
||||||
#ifndef LABWC_VIEW_H
|
#ifndef LABWC_VIEW_H
|
||||||
#define LABWC_VIEW_H
|
#define LABWC_VIEW_H
|
||||||
|
|
||||||
#include "config/rcxml.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "ssd.h"
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include "common/three-state.h"
|
#include "config.h"
|
||||||
|
#include "config/types.h"
|
||||||
|
|
||||||
#define LAB_MIN_VIEW_HEIGHT 60
|
#define LAB_MIN_VIEW_HEIGHT 60
|
||||||
|
|
||||||
|
|
@ -58,27 +56,6 @@ enum view_axis {
|
||||||
VIEW_AXIS_INVALID = (1 << 2),
|
VIEW_AXIS_INVALID = (1 << 2),
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Edges to which a view can be snapped to. "All" is used as
|
|
||||||
* a catchall for every valid edge in order to simplify certain
|
|
||||||
* types of conditionals, but it is only valid for a selection
|
|
||||||
* of options in rc.xml.
|
|
||||||
*/
|
|
||||||
enum view_edge {
|
|
||||||
VIEW_EDGE_INVALID = 0,
|
|
||||||
|
|
||||||
VIEW_EDGE_LEFT = (1 << 0),
|
|
||||||
VIEW_EDGE_RIGHT = (1 << 1),
|
|
||||||
VIEW_EDGE_UP = (1 << 2),
|
|
||||||
VIEW_EDGE_DOWN = (1 << 3),
|
|
||||||
VIEW_EDGE_CENTER = (1 << 4),
|
|
||||||
VIEW_EDGE_ANY = (1 << 5),
|
|
||||||
VIEW_EDGE_UPLEFT = (VIEW_EDGE_UP | VIEW_EDGE_LEFT),
|
|
||||||
VIEW_EDGE_UPRIGHT = (VIEW_EDGE_UP | VIEW_EDGE_RIGHT),
|
|
||||||
VIEW_EDGE_DOWNLEFT = (VIEW_EDGE_DOWN | VIEW_EDGE_LEFT),
|
|
||||||
VIEW_EDGE_DOWNRIGHT = (VIEW_EDGE_DOWN | VIEW_EDGE_RIGHT),
|
|
||||||
};
|
|
||||||
|
|
||||||
enum view_wants_focus {
|
enum view_wants_focus {
|
||||||
/* View does not want focus */
|
/* View does not want focus */
|
||||||
VIEW_WANTS_FOCUS_NEVER = 0,
|
VIEW_WANTS_FOCUS_NEVER = 0,
|
||||||
|
|
@ -99,33 +76,6 @@ enum view_wants_focus {
|
||||||
VIEW_WANTS_FOCUS_UNLIKELY,
|
VIEW_WANTS_FOCUS_UNLIKELY,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* Window types are based on the NET_WM constants from X11. See:
|
|
||||||
* https://specifications.freedesktop.org/wm-spec/1.4/ar01s05.html#id-1.6.7
|
|
||||||
*
|
|
||||||
* The enum constants are intended to match wlr_xwayland_net_wm_window_type.
|
|
||||||
* Redefining the same constants here may seem redundant, but is necessary
|
|
||||||
* to make them available even in builds with xwayland support disabled.
|
|
||||||
*/
|
|
||||||
enum window_type {
|
|
||||||
NET_WM_WINDOW_TYPE_DESKTOP = 0,
|
|
||||||
NET_WM_WINDOW_TYPE_DOCK,
|
|
||||||
NET_WM_WINDOW_TYPE_TOOLBAR,
|
|
||||||
NET_WM_WINDOW_TYPE_MENU,
|
|
||||||
NET_WM_WINDOW_TYPE_UTILITY,
|
|
||||||
NET_WM_WINDOW_TYPE_SPLASH,
|
|
||||||
NET_WM_WINDOW_TYPE_DIALOG,
|
|
||||||
NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
|
|
||||||
NET_WM_WINDOW_TYPE_POPUP_MENU,
|
|
||||||
NET_WM_WINDOW_TYPE_TOOLTIP,
|
|
||||||
NET_WM_WINDOW_TYPE_NOTIFICATION,
|
|
||||||
NET_WM_WINDOW_TYPE_COMBO,
|
|
||||||
NET_WM_WINDOW_TYPE_DND,
|
|
||||||
NET_WM_WINDOW_TYPE_NORMAL,
|
|
||||||
|
|
||||||
WINDOW_TYPE_LEN
|
|
||||||
};
|
|
||||||
|
|
||||||
struct view;
|
struct view;
|
||||||
struct wlr_surface;
|
struct wlr_surface;
|
||||||
struct foreign_toplevel;
|
struct foreign_toplevel;
|
||||||
|
|
@ -175,7 +125,7 @@ struct view_impl {
|
||||||
bool (*has_strut_partial)(struct view *self);
|
bool (*has_strut_partial)(struct view *self);
|
||||||
/* returns true if view declared itself a window type */
|
/* returns true if view declared itself a window type */
|
||||||
bool (*contains_window_type)(struct view *view,
|
bool (*contains_window_type)(struct view *view,
|
||||||
enum window_type window_type);
|
enum lab_window_type window_type);
|
||||||
/* returns the client pid that this view belongs to */
|
/* returns the client pid that this view belongs to */
|
||||||
pid_t (*get_pid)(struct view *view);
|
pid_t (*get_pid)(struct view *view);
|
||||||
};
|
};
|
||||||
|
|
@ -227,9 +177,9 @@ struct view {
|
||||||
enum view_axis maximized;
|
enum view_axis maximized;
|
||||||
bool fullscreen;
|
bool fullscreen;
|
||||||
bool tearing_hint;
|
bool tearing_hint;
|
||||||
enum three_state force_tearing;
|
enum lab_tristate force_tearing;
|
||||||
bool visible_on_all_workspaces;
|
bool visible_on_all_workspaces;
|
||||||
enum view_edge tiled;
|
enum lab_edge tiled;
|
||||||
uint32_t edges_visible; /* enum wlr_edges bitset */
|
uint32_t edges_visible; /* enum wlr_edges bitset */
|
||||||
bool inhibits_keybinds; /* also inhibits mousebinds */
|
bool inhibits_keybinds; /* also inhibits mousebinds */
|
||||||
xkb_layout_index_t keyboard_layout;
|
xkb_layout_index_t keyboard_layout;
|
||||||
|
|
@ -327,15 +277,15 @@ struct view_query {
|
||||||
int window_type;
|
int window_type;
|
||||||
char *sandbox_engine;
|
char *sandbox_engine;
|
||||||
char *sandbox_app_id;
|
char *sandbox_app_id;
|
||||||
enum three_state shaded;
|
enum lab_tristate shaded;
|
||||||
enum view_axis maximized;
|
enum view_axis maximized;
|
||||||
enum three_state iconified;
|
enum lab_tristate iconified;
|
||||||
enum three_state focused;
|
enum lab_tristate focused;
|
||||||
enum three_state omnipresent;
|
enum lab_tristate omnipresent;
|
||||||
enum view_edge tiled;
|
enum lab_edge tiled;
|
||||||
char *tiled_region;
|
char *tiled_region;
|
||||||
char *desktop;
|
char *desktop;
|
||||||
enum ssd_mode decoration;
|
enum lab_ssd_mode decoration;
|
||||||
char *monitor;
|
char *monitor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -349,28 +299,6 @@ struct xdg_toplevel_view {
|
||||||
struct wl_listener new_popup;
|
struct wl_listener new_popup;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* All criteria is applied in AND logic */
|
|
||||||
enum lab_view_criteria {
|
|
||||||
/* No filter -> all focusable views */
|
|
||||||
LAB_VIEW_CRITERIA_NONE = 0,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Includes always-on-top views, e.g.
|
|
||||||
* what is visible on the current workspace
|
|
||||||
*/
|
|
||||||
LAB_VIEW_CRITERIA_CURRENT_WORKSPACE = 1 << 0,
|
|
||||||
|
|
||||||
/* Positive criteria */
|
|
||||||
LAB_VIEW_CRITERIA_FULLSCREEN = 1 << 1,
|
|
||||||
LAB_VIEW_CRITERIA_ALWAYS_ON_TOP = 1 << 2,
|
|
||||||
LAB_VIEW_CRITERIA_ROOT_TOPLEVEL = 1 << 3,
|
|
||||||
|
|
||||||
/* Negative criteria */
|
|
||||||
LAB_VIEW_CRITERIA_NO_ALWAYS_ON_TOP = 1 << 6,
|
|
||||||
LAB_VIEW_CRITERIA_NO_SKIP_WINDOW_SWITCHER = 1 << 7,
|
|
||||||
LAB_VIEW_CRITERIA_NO_OMNIPRESENT = 1 << 8,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* view_from_wlr_surface() - returns the view associated with a
|
* view_from_wlr_surface() - returns the view associated with a
|
||||||
* wlr_surface, or NULL if the surface has no associated view.
|
* wlr_surface, or NULL if the surface has no associated view.
|
||||||
|
|
@ -492,20 +420,20 @@ void view_array_append(struct server *server, struct wl_array *views,
|
||||||
enum lab_view_criteria criteria);
|
enum lab_view_criteria criteria);
|
||||||
|
|
||||||
enum view_wants_focus view_wants_focus(struct view *view);
|
enum view_wants_focus view_wants_focus(struct view *view);
|
||||||
bool view_contains_window_type(struct view *view, enum window_type window_type);
|
bool view_contains_window_type(struct view *view, enum lab_window_type window_type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* view_edge_invert() - select the opposite of a provided edge
|
* view_edge_invert() - select the opposite of a provided edge
|
||||||
*
|
*
|
||||||
* VIEW_EDGE_CENTER and VIEW_EDGE_INVALID both map to VIEW_EDGE_INVALID.
|
* LAB_EDGE_CENTER and LAB_EDGE_INVALID both map to LAB_EDGE_INVALID.
|
||||||
*
|
*
|
||||||
* @edge: edge to be inverted
|
* @edge: edge to be inverted
|
||||||
*/
|
*/
|
||||||
enum view_edge view_edge_invert(enum view_edge edge);
|
enum lab_edge view_edge_invert(enum lab_edge edge);
|
||||||
|
|
||||||
/* If view is NULL, the size of SSD is not considered */
|
/* If view is NULL, the size of SSD is not considered */
|
||||||
struct wlr_box view_get_edge_snap_box(struct view *view, struct output *output,
|
struct wlr_box view_get_edge_snap_box(struct view *view, struct output *output,
|
||||||
enum view_edge edge);
|
enum lab_edge edge);
|
||||||
struct wlr_box view_get_region_snap_box(struct view *view, struct region *region);
|
struct wlr_box view_get_region_snap_box(struct view *view, struct region *region);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -529,7 +457,7 @@ bool view_is_focusable(struct view *view);
|
||||||
void view_offer_focus(struct view *view);
|
void view_offer_focus(struct view *view);
|
||||||
|
|
||||||
struct wlr_box view_get_edge_snap_box(struct view *view, struct output *output,
|
struct wlr_box view_get_edge_snap_box(struct view *view, struct output *output,
|
||||||
enum view_edge edge);
|
enum lab_edge edge);
|
||||||
|
|
||||||
void mappable_connect(struct mappable *mappable, struct wlr_surface *surface,
|
void mappable_connect(struct mappable *mappable, struct wlr_surface *surface,
|
||||||
wl_notify_func_t notify_map, wl_notify_func_t notify_unmap);
|
wl_notify_func_t notify_map, wl_notify_func_t notify_unmap);
|
||||||
|
|
@ -591,7 +519,7 @@ void view_center(struct view *view, const struct wlr_box *ref);
|
||||||
* @policy: placement policy to apply
|
* @policy: placement policy to apply
|
||||||
*/
|
*/
|
||||||
void view_place_by_policy(struct view *view, bool allow_cursor,
|
void view_place_by_policy(struct view *view, bool allow_cursor,
|
||||||
enum view_placement_policy policy);
|
enum lab_placement_policy policy);
|
||||||
void view_constrain_size_to_that_of_usable_area(struct view *view);
|
void view_constrain_size_to_that_of_usable_area(struct view *view);
|
||||||
|
|
||||||
void view_restore_to(struct view *view, struct wlr_box geometry);
|
void view_restore_to(struct view *view, struct wlr_box geometry);
|
||||||
|
|
@ -614,16 +542,16 @@ bool view_is_tiled(struct view *view);
|
||||||
bool view_is_tiled_and_notify_tiled(struct view *view);
|
bool view_is_tiled_and_notify_tiled(struct view *view);
|
||||||
bool view_is_floating(struct view *view);
|
bool view_is_floating(struct view *view);
|
||||||
void view_move_to_workspace(struct view *view, struct workspace *workspace);
|
void view_move_to_workspace(struct view *view, struct workspace *workspace);
|
||||||
enum ssd_mode view_get_ssd_mode(struct view *view);
|
enum lab_ssd_mode view_get_ssd_mode(struct view *view);
|
||||||
void view_set_ssd_mode(struct view *view, enum ssd_mode mode);
|
void view_set_ssd_mode(struct view *view, enum lab_ssd_mode mode);
|
||||||
void view_set_decorations(struct view *view, enum ssd_mode mode, bool force_ssd);
|
void view_set_decorations(struct view *view, enum lab_ssd_mode mode, bool force_ssd);
|
||||||
void view_toggle_fullscreen(struct view *view);
|
void view_toggle_fullscreen(struct view *view);
|
||||||
void view_invalidate_last_layout_geometry(struct view *view);
|
void view_invalidate_last_layout_geometry(struct view *view);
|
||||||
void view_adjust_for_layout_change(struct view *view);
|
void view_adjust_for_layout_change(struct view *view);
|
||||||
void view_move_to_edge(struct view *view, enum view_edge direction, bool snap_to_windows);
|
void view_move_to_edge(struct view *view, enum lab_edge direction, bool snap_to_windows);
|
||||||
void view_grow_to_edge(struct view *view, enum view_edge direction);
|
void view_grow_to_edge(struct view *view, enum lab_edge direction);
|
||||||
void view_shrink_to_edge(struct view *view, enum view_edge direction);
|
void view_shrink_to_edge(struct view *view, enum lab_edge direction);
|
||||||
void view_snap_to_edge(struct view *view, enum view_edge direction,
|
void view_snap_to_edge(struct view *view, enum lab_edge direction,
|
||||||
bool across_outputs, bool store_natural_geometry);
|
bool across_outputs, bool store_natural_geometry);
|
||||||
void view_snap_to_region(struct view *view, struct region *region, bool store_natural_geometry);
|
void view_snap_to_region(struct view *view, struct region *region, bool store_natural_geometry);
|
||||||
void view_move_to_output(struct view *view, struct output *output);
|
void view_move_to_output(struct view *view, struct output *output);
|
||||||
|
|
@ -673,8 +601,8 @@ void view_init(struct view *view);
|
||||||
void view_destroy(struct view *view);
|
void view_destroy(struct view *view);
|
||||||
|
|
||||||
enum view_axis view_axis_parse(const char *direction);
|
enum view_axis view_axis_parse(const char *direction);
|
||||||
enum view_edge view_edge_parse(const char *direction, bool tiled, bool any);
|
enum lab_edge view_edge_parse(const char *direction, bool tiled, bool any);
|
||||||
enum view_placement_policy view_placement_parse(const char *policy);
|
enum lab_placement_policy view_placement_parse(const char *policy);
|
||||||
|
|
||||||
/* xdg.c */
|
/* xdg.c */
|
||||||
struct wlr_xdg_surface *xdg_surface_from_view(struct view *view);
|
struct wlr_xdg_surface *xdg_surface_from_view(struct view *view);
|
||||||
|
|
|
||||||
32
src/action.c
32
src/action.c
|
|
@ -15,7 +15,9 @@
|
||||||
#include "common/parse-bool.h"
|
#include "common/parse-bool.h"
|
||||||
#include "common/spawn.h"
|
#include "common/spawn.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include "input/keyboard.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "magnifier.h"
|
#include "magnifier.h"
|
||||||
#include "menu/menu.h"
|
#include "menu/menu.h"
|
||||||
|
|
@ -24,9 +26,9 @@
|
||||||
#include "output-virtual.h"
|
#include "output-virtual.h"
|
||||||
#include "regions.h"
|
#include "regions.h"
|
||||||
#include "ssd.h"
|
#include "ssd.h"
|
||||||
|
#include "theme.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include "workspaces.h"
|
#include "workspaces.h"
|
||||||
#include "input/keyboard.h"
|
|
||||||
|
|
||||||
enum action_arg_type {
|
enum action_arg_type {
|
||||||
LAB_ACTION_ARG_STR = 0,
|
LAB_ACTION_ARG_STR = 0,
|
||||||
|
|
@ -345,8 +347,8 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
||||||
if (!strcmp(argument, "direction")) {
|
if (!strcmp(argument, "direction")) {
|
||||||
bool tiled = (action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE
|
bool tiled = (action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE
|
||||||
|| action->type == ACTION_TYPE_SNAP_TO_EDGE);
|
|| action->type == ACTION_TYPE_SNAP_TO_EDGE);
|
||||||
enum view_edge edge = view_edge_parse(content, tiled, /*any*/ false);
|
enum lab_edge edge = view_edge_parse(content, tiled, /*any*/ false);
|
||||||
if (edge == VIEW_EDGE_INVALID) {
|
if (edge == LAB_EDGE_INVALID) {
|
||||||
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
||||||
action_names[action->type], argument, content);
|
action_names[action->type], argument, content);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -389,7 +391,7 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_SET_DECORATIONS:
|
case ACTION_TYPE_SET_DECORATIONS:
|
||||||
if (!strcmp(argument, "decorations")) {
|
if (!strcmp(argument, "decorations")) {
|
||||||
enum ssd_mode mode = ssd_mode_parse(content);
|
enum lab_ssd_mode mode = ssd_mode_parse(content);
|
||||||
if (mode != LAB_SSD_MODE_INVALID) {
|
if (mode != LAB_SSD_MODE_INVALID) {
|
||||||
action_arg_add_int(action, argument, mode);
|
action_arg_add_int(action, argument, mode);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -453,9 +455,9 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if (!strcmp(argument, "direction")) {
|
if (!strcmp(argument, "direction")) {
|
||||||
enum view_edge edge = view_edge_parse(content,
|
enum lab_edge edge = view_edge_parse(content,
|
||||||
/*tiled*/ false, /*any*/ false);
|
/*tiled*/ false, /*any*/ false);
|
||||||
if (edge == VIEW_EDGE_INVALID) {
|
if (edge == LAB_EDGE_INVALID) {
|
||||||
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
||||||
action_names[action->type], argument, content);
|
action_names[action->type], argument, content);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -477,7 +479,7 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_AUTO_PLACE:
|
case ACTION_TYPE_AUTO_PLACE:
|
||||||
if (!strcmp(argument, "policy")) {
|
if (!strcmp(argument, "policy")) {
|
||||||
enum view_placement_policy policy =
|
enum lab_placement_policy policy =
|
||||||
view_placement_parse(content);
|
view_placement_parse(content);
|
||||||
if (policy == LAB_PLACE_INVALID) {
|
if (policy == LAB_PLACE_INVALID) {
|
||||||
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
wlr_log(WLR_ERROR, "Invalid argument for action %s: '%s' (%s)",
|
||||||
|
|
@ -913,8 +915,8 @@ get_target_output(struct output *output, struct server *server,
|
||||||
if (output_name) {
|
if (output_name) {
|
||||||
target = output_from_name(server, output_name);
|
target = output_from_name(server, output_name);
|
||||||
} else {
|
} else {
|
||||||
enum view_edge edge =
|
enum lab_edge edge =
|
||||||
action_get_int(action, "direction", VIEW_EDGE_INVALID);
|
action_get_int(action, "direction", LAB_EDGE_INVALID);
|
||||||
bool wrap = action_get_bool(action, "wrap", false);
|
bool wrap = action_get_bool(action, "wrap", false);
|
||||||
target = output_get_adjacent(output, edge, wrap);
|
target = output_get_adjacent(output, edge, wrap);
|
||||||
}
|
}
|
||||||
|
|
@ -1003,7 +1005,7 @@ run_action(struct view *view, struct server *server, struct action *action,
|
||||||
case ACTION_TYPE_MOVE_TO_EDGE:
|
case ACTION_TYPE_MOVE_TO_EDGE:
|
||||||
if (view) {
|
if (view) {
|
||||||
/* Config parsing makes sure that direction is a valid direction */
|
/* Config parsing makes sure that direction is a valid direction */
|
||||||
enum view_edge edge = action_get_int(action, "direction", 0);
|
enum lab_edge edge = action_get_int(action, "direction", 0);
|
||||||
bool snap_to_windows = action_get_bool(action, "snapWindows", true);
|
bool snap_to_windows = action_get_bool(action, "snapWindows", true);
|
||||||
view_move_to_edge(view, edge, snap_to_windows);
|
view_move_to_edge(view, edge, snap_to_windows);
|
||||||
}
|
}
|
||||||
|
|
@ -1012,7 +1014,7 @@ run_action(struct view *view, struct server *server, struct action *action,
|
||||||
case ACTION_TYPE_SNAP_TO_EDGE:
|
case ACTION_TYPE_SNAP_TO_EDGE:
|
||||||
if (view) {
|
if (view) {
|
||||||
/* Config parsing makes sure that direction is a valid direction */
|
/* Config parsing makes sure that direction is a valid direction */
|
||||||
enum view_edge edge = action_get_int(action, "direction", 0);
|
enum lab_edge edge = action_get_int(action, "direction", 0);
|
||||||
if (action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE
|
if (action->type == ACTION_TYPE_TOGGLE_SNAP_TO_EDGE
|
||||||
&& view->maximized == VIEW_AXIS_NONE
|
&& view->maximized == VIEW_AXIS_NONE
|
||||||
&& !view->fullscreen
|
&& !view->fullscreen
|
||||||
|
|
@ -1030,14 +1032,14 @@ run_action(struct view *view, struct server *server, struct action *action,
|
||||||
case ACTION_TYPE_GROW_TO_EDGE:
|
case ACTION_TYPE_GROW_TO_EDGE:
|
||||||
if (view) {
|
if (view) {
|
||||||
/* Config parsing makes sure that direction is a valid direction */
|
/* Config parsing makes sure that direction is a valid direction */
|
||||||
enum view_edge edge = action_get_int(action, "direction", 0);
|
enum lab_edge edge = action_get_int(action, "direction", 0);
|
||||||
view_grow_to_edge(view, edge);
|
view_grow_to_edge(view, edge);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_SHRINK_TO_EDGE:
|
case ACTION_TYPE_SHRINK_TO_EDGE:
|
||||||
if (view) {
|
if (view) {
|
||||||
/* Config parsing makes sure that direction is a valid direction */
|
/* Config parsing makes sure that direction is a valid direction */
|
||||||
enum view_edge edge = action_get_int(action, "direction", 0);
|
enum lab_edge edge = action_get_int(action, "direction", 0);
|
||||||
view_shrink_to_edge(view, edge);
|
view_shrink_to_edge(view, edge);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1095,7 +1097,7 @@ run_action(struct view *view, struct server *server, struct action *action,
|
||||||
break;
|
break;
|
||||||
case ACTION_TYPE_SET_DECORATIONS:
|
case ACTION_TYPE_SET_DECORATIONS:
|
||||||
if (view) {
|
if (view) {
|
||||||
enum ssd_mode mode = action_get_int(action,
|
enum lab_ssd_mode mode = action_get_int(action,
|
||||||
"decorations", LAB_SSD_MODE_FULL);
|
"decorations", LAB_SSD_MODE_FULL);
|
||||||
bool force_ssd = action_get_bool(action,
|
bool force_ssd = action_get_bool(action,
|
||||||
"forceSSD", false);
|
"forceSSD", false);
|
||||||
|
|
@ -1378,7 +1380,7 @@ run_action(struct view *view, struct server *server, struct action *action,
|
||||||
}
|
}
|
||||||
case ACTION_TYPE_AUTO_PLACE:
|
case ACTION_TYPE_AUTO_PLACE:
|
||||||
if (view) {
|
if (view) {
|
||||||
enum view_placement_policy policy =
|
enum lab_placement_policy policy =
|
||||||
action_get_int(action, "policy", LAB_PLACE_AUTOMATIC);
|
action_get_int(action, "policy", LAB_PLACE_AUTOMATIC);
|
||||||
view_place_by_policy(view,
|
view_place_by_policy(view,
|
||||||
/* allow_cursor */ true, policy);
|
/* allow_cursor */ true, policy);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
#include "common/list.h"
|
#include "common/list.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
||||||
struct dir {
|
struct dir {
|
||||||
|
|
|
||||||
|
|
@ -5,19 +5,19 @@
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
direction_from_view_edge(enum view_edge edge, enum wlr_direction *direction)
|
direction_from_edge(enum lab_edge edge, enum wlr_direction *direction)
|
||||||
{
|
{
|
||||||
switch (edge) {
|
switch (edge) {
|
||||||
case VIEW_EDGE_LEFT:
|
case LAB_EDGE_LEFT:
|
||||||
*direction = WLR_DIRECTION_LEFT;
|
*direction = WLR_DIRECTION_LEFT;
|
||||||
return true;
|
return true;
|
||||||
case VIEW_EDGE_RIGHT:
|
case LAB_EDGE_RIGHT:
|
||||||
*direction = WLR_DIRECTION_RIGHT;
|
*direction = WLR_DIRECTION_RIGHT;
|
||||||
return true;
|
return true;
|
||||||
case VIEW_EDGE_UP:
|
case LAB_EDGE_UP:
|
||||||
*direction = WLR_DIRECTION_UP;
|
*direction = WLR_DIRECTION_UP;
|
||||||
return true;
|
return true;
|
||||||
case VIEW_EDGE_DOWN:
|
case LAB_EDGE_DOWN:
|
||||||
*direction = WLR_DIRECTION_DOWN;
|
*direction = WLR_DIRECTION_DOWN;
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
enum three_state
|
enum lab_tristate
|
||||||
parse_three_state(const char *str)
|
parse_tristate(const char *str)
|
||||||
{
|
{
|
||||||
if (!str) {
|
if (!str) {
|
||||||
goto error_not_a_boolean;
|
goto error_not_a_boolean;
|
||||||
|
|
@ -33,7 +33,7 @@ error_not_a_boolean:
|
||||||
int
|
int
|
||||||
parse_bool(const char *str, int default_value)
|
parse_bool(const char *str, int default_value)
|
||||||
{
|
{
|
||||||
enum three_state val = parse_three_state(str);
|
enum lab_tristate val = parse_tristate(str);
|
||||||
if (val == LAB_STATE_UNSPECIFIED) {
|
if (val == LAB_STATE_UNSPECIFIED) {
|
||||||
return default_value;
|
return default_value;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,14 @@
|
||||||
#include "common/parse-bool.h"
|
#include "common/parse-bool.h"
|
||||||
#include "common/parse-double.h"
|
#include "common/parse-double.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
#include "common/three-state.h"
|
|
||||||
#include "common/xml.h"
|
#include "common/xml.h"
|
||||||
#include "config/default-bindings.h"
|
#include "config/default-bindings.h"
|
||||||
#include "config/keybind.h"
|
#include "config/keybind.h"
|
||||||
#include "config/libinput.h"
|
#include "config/libinput.h"
|
||||||
#include "config/mousebind.h"
|
#include "config/mousebind.h"
|
||||||
#include "config/tablet.h"
|
#include "config/tablet.h"
|
||||||
|
#include "config/tablet-tool.h"
|
||||||
|
#include "config/touch.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
#include "regions.h"
|
#include "regions.h"
|
||||||
|
|
@ -62,33 +63,33 @@ parse_window_type(const char *type)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!strcasecmp(type, "desktop")) {
|
if (!strcasecmp(type, "desktop")) {
|
||||||
return NET_WM_WINDOW_TYPE_DESKTOP;
|
return LAB_WINDOW_TYPE_DESKTOP;
|
||||||
} else if (!strcasecmp(type, "dock")) {
|
} else if (!strcasecmp(type, "dock")) {
|
||||||
return NET_WM_WINDOW_TYPE_DOCK;
|
return LAB_WINDOW_TYPE_DOCK;
|
||||||
} else if (!strcasecmp(type, "toolbar")) {
|
} else if (!strcasecmp(type, "toolbar")) {
|
||||||
return NET_WM_WINDOW_TYPE_TOOLBAR;
|
return LAB_WINDOW_TYPE_TOOLBAR;
|
||||||
} else if (!strcasecmp(type, "menu")) {
|
} else if (!strcasecmp(type, "menu")) {
|
||||||
return NET_WM_WINDOW_TYPE_MENU;
|
return LAB_WINDOW_TYPE_MENU;
|
||||||
} else if (!strcasecmp(type, "utility")) {
|
} else if (!strcasecmp(type, "utility")) {
|
||||||
return NET_WM_WINDOW_TYPE_UTILITY;
|
return LAB_WINDOW_TYPE_UTILITY;
|
||||||
} else if (!strcasecmp(type, "splash")) {
|
} else if (!strcasecmp(type, "splash")) {
|
||||||
return NET_WM_WINDOW_TYPE_SPLASH;
|
return LAB_WINDOW_TYPE_SPLASH;
|
||||||
} else if (!strcasecmp(type, "dialog")) {
|
} else if (!strcasecmp(type, "dialog")) {
|
||||||
return NET_WM_WINDOW_TYPE_DIALOG;
|
return LAB_WINDOW_TYPE_DIALOG;
|
||||||
} else if (!strcasecmp(type, "dropdown_menu")) {
|
} else if (!strcasecmp(type, "dropdown_menu")) {
|
||||||
return NET_WM_WINDOW_TYPE_DROPDOWN_MENU;
|
return LAB_WINDOW_TYPE_DROPDOWN_MENU;
|
||||||
} else if (!strcasecmp(type, "popup_menu")) {
|
} else if (!strcasecmp(type, "popup_menu")) {
|
||||||
return NET_WM_WINDOW_TYPE_POPUP_MENU;
|
return LAB_WINDOW_TYPE_POPUP_MENU;
|
||||||
} else if (!strcasecmp(type, "tooltip")) {
|
} else if (!strcasecmp(type, "tooltip")) {
|
||||||
return NET_WM_WINDOW_TYPE_TOOLTIP;
|
return LAB_WINDOW_TYPE_TOOLTIP;
|
||||||
} else if (!strcasecmp(type, "notification")) {
|
} else if (!strcasecmp(type, "notification")) {
|
||||||
return NET_WM_WINDOW_TYPE_NOTIFICATION;
|
return LAB_WINDOW_TYPE_NOTIFICATION;
|
||||||
} else if (!strcasecmp(type, "combo")) {
|
} else if (!strcasecmp(type, "combo")) {
|
||||||
return NET_WM_WINDOW_TYPE_COMBO;
|
return LAB_WINDOW_TYPE_COMBO;
|
||||||
} else if (!strcasecmp(type, "dnd")) {
|
} else if (!strcasecmp(type, "dnd")) {
|
||||||
return NET_WM_WINDOW_TYPE_DND;
|
return LAB_WINDOW_TYPE_DND;
|
||||||
} else if (!strcasecmp(type, "normal")) {
|
} else if (!strcasecmp(type, "normal")) {
|
||||||
return NET_WM_WINDOW_TYPE_NORMAL;
|
return LAB_WINDOW_TYPE_NORMAL;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -433,15 +434,15 @@ fill_action_query(struct action *action, xmlNode *node, struct view_query *query
|
||||||
} else if (!strcasecmp(key, "sandboxAppId")) {
|
} else if (!strcasecmp(key, "sandboxAppId")) {
|
||||||
xstrdup_replace(query->sandbox_app_id, content);
|
xstrdup_replace(query->sandbox_app_id, content);
|
||||||
} else if (!strcasecmp(key, "shaded")) {
|
} else if (!strcasecmp(key, "shaded")) {
|
||||||
query->shaded = parse_three_state(content);
|
query->shaded = parse_tristate(content);
|
||||||
} else if (!strcasecmp(key, "maximized")) {
|
} else if (!strcasecmp(key, "maximized")) {
|
||||||
query->maximized = view_axis_parse(content);
|
query->maximized = view_axis_parse(content);
|
||||||
} else if (!strcasecmp(key, "iconified")) {
|
} else if (!strcasecmp(key, "iconified")) {
|
||||||
query->iconified = parse_three_state(content);
|
query->iconified = parse_tristate(content);
|
||||||
} else if (!strcasecmp(key, "focused")) {
|
} else if (!strcasecmp(key, "focused")) {
|
||||||
query->focused = parse_three_state(content);
|
query->focused = parse_tristate(content);
|
||||||
} else if (!strcasecmp(key, "omnipresent")) {
|
} else if (!strcasecmp(key, "omnipresent")) {
|
||||||
query->omnipresent = parse_three_state(content);
|
query->omnipresent = parse_tristate(content);
|
||||||
} else if (!strcasecmp(key, "tiled")) {
|
} else if (!strcasecmp(key, "tiled")) {
|
||||||
query->tiled = view_edge_parse(content,
|
query->tiled = view_edge_parse(content,
|
||||||
/*tiled*/ true, /*any*/ true);
|
/*tiled*/ true, /*any*/ true);
|
||||||
|
|
@ -1108,7 +1109,7 @@ entry(xmlNode *node, char *nodename, char *content)
|
||||||
} else if (!strcasecmp(nodename, "primarySelection.core")) {
|
} else if (!strcasecmp(nodename, "primarySelection.core")) {
|
||||||
set_bool(content, &rc.primary_selection);
|
set_bool(content, &rc.primary_selection);
|
||||||
} else if (!strcmp(nodename, "policy.placement")) {
|
} else if (!strcmp(nodename, "policy.placement")) {
|
||||||
enum view_placement_policy policy = view_placement_parse(content);
|
enum lab_placement_policy policy = view_placement_parse(content);
|
||||||
if (policy != LAB_PLACE_INVALID) {
|
if (policy != LAB_PLACE_INVALID) {
|
||||||
rc.placement_policy = policy;
|
rc.placement_policy = policy;
|
||||||
}
|
}
|
||||||
|
|
@ -1401,7 +1402,7 @@ rcxml_init(void)
|
||||||
rc.tablet.rotation = 0;
|
rc.tablet.rotation = 0;
|
||||||
rc.tablet.box = (struct wlr_fbox){0};
|
rc.tablet.box = (struct wlr_fbox){0};
|
||||||
tablet_load_default_button_mappings();
|
tablet_load_default_button_mappings();
|
||||||
rc.tablet_tool.motion = LAB_TABLET_MOTION_ABSOLUTE;
|
rc.tablet_tool.motion = LAB_MOTION_ABSOLUTE;
|
||||||
rc.tablet_tool.relative_motion_sensitivity = 1.0;
|
rc.tablet_tool.relative_motion_sensitivity = 1.0;
|
||||||
|
|
||||||
rc.repeat_rate = 25;
|
rc.repeat_rate = 25;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
#include "common/parse-bool.h"
|
#include "common/parse-bool.h"
|
||||||
#include "common/spawn.h"
|
#include "common/spawn.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
||||||
static const char *const env_vars[] = {
|
static const char *const env_vars[] = {
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
enum motion
|
enum lab_motion
|
||||||
tablet_parse_motion(const char *name)
|
tablet_parse_motion(const char *name)
|
||||||
{
|
{
|
||||||
if (!strcasecmp(name, "Absolute")) {
|
if (!strcasecmp(name, "Absolute")) {
|
||||||
return LAB_TABLET_MOTION_ABSOLUTE;
|
return LAB_MOTION_ABSOLUTE;
|
||||||
} else if (!strcasecmp(name, "Relative")) {
|
} else if (!strcasecmp(name, "Relative")) {
|
||||||
return LAB_TABLET_MOTION_RELATIVE;
|
return LAB_MOTION_RELATIVE;
|
||||||
}
|
}
|
||||||
wlr_log(WLR_ERROR, "Invalid value for tablet motion: %s", name);
|
wlr_log(WLR_ERROR, "Invalid value for tablet motion: %s", name);
|
||||||
return LAB_TABLET_MOTION_ABSOLUTE;
|
return LAB_MOTION_ABSOLUTE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ tablet_get_dbl_if_positive(const char *content, const char *name)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum rotation
|
enum lab_rotation
|
||||||
tablet_parse_rotation(int value)
|
tablet_parse_rotation(int value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
#include <stdlib.h>
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "common/lab-scene-rect.h"
|
#include "common/lab-scene-rect.h"
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
#include "common/list.h"
|
#include "common/list.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "decorations.h"
|
#include "decorations.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "decorations.h"
|
#include "decorations.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "img/img.h"
|
#include "img/img.h"
|
||||||
|
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <wlr/types/wlr_data_device.h>
|
#include <wlr/types/wlr_data_device.h>
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "input/cursor.h"
|
#include "input/cursor.h"
|
||||||
#include "labwc.h" /* for struct seat */
|
#include "labwc.h" /* for struct seat */
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
#include "common/scene-helpers.h"
|
#include "common/scene-helpers.h"
|
||||||
#include "common/surface-helpers.h"
|
#include "common/surface-helpers.h"
|
||||||
#include "config/mousebind.h"
|
#include "config/mousebind.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "dnd.h"
|
#include "dnd.h"
|
||||||
#include "idle.h"
|
#include "idle.h"
|
||||||
#include "input/gestures.h"
|
#include "input/gestures.h"
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@
|
||||||
#include <wlr/types/wlr_keyboard_group.h>
|
#include <wlr/types/wlr_keyboard_group.h>
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/three-state.h"
|
|
||||||
#include "config/keybind.h"
|
#include "config/keybind.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "idle.h"
|
#include "idle.h"
|
||||||
#include "input/ime.h"
|
#include "input/ime.h"
|
||||||
#include "input/key-state.h"
|
#include "input/key-state.h"
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "config/rcxml.h"
|
#include "config/rcxml.h"
|
||||||
|
#include "config/tablet.h"
|
||||||
#include "input/cursor.h"
|
#include "input/cursor.h"
|
||||||
#include "input/tablet.h"
|
#include "input/tablet.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
#include "common/scene-helpers.h"
|
#include "common/scene-helpers.h"
|
||||||
#include "config/rcxml.h"
|
#include "config/rcxml.h"
|
||||||
#include "config/mousebind.h"
|
#include "config/mousebind.h"
|
||||||
|
#include "config/tablet.h"
|
||||||
#include "input/cursor.h"
|
#include "input/cursor.h"
|
||||||
#include "input/tablet-pad.h"
|
#include "input/tablet-pad.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
@ -92,8 +93,8 @@ tablet_tool_create(struct seat *seat,
|
||||||
return tool;
|
return tool;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum motion
|
static enum lab_motion
|
||||||
tool_motion_mode(enum motion motion, struct wlr_tablet_tool *tool)
|
tool_motion_mode(enum lab_motion motion, struct wlr_tablet_tool *tool)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Absolute positioning doesn't make sense
|
* Absolute positioning doesn't make sense
|
||||||
|
|
@ -102,7 +103,7 @@ tool_motion_mode(enum motion motion, struct wlr_tablet_tool *tool)
|
||||||
switch (tool->type) {
|
switch (tool->type) {
|
||||||
case WLR_TABLET_TOOL_TYPE_MOUSE:
|
case WLR_TABLET_TOOL_TYPE_MOUSE:
|
||||||
case WLR_TABLET_TOOL_TYPE_LENS:
|
case WLR_TABLET_TOOL_TYPE_LENS:
|
||||||
return LAB_TABLET_MOTION_RELATIVE;
|
return LAB_MOTION_RELATIVE;
|
||||||
default:
|
default:
|
||||||
return motion;
|
return motion;
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +138,7 @@ adjust_for_tablet_area(double tablet_width, double tablet_height,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
adjust_for_rotation(enum rotation rotation, double *x, double *y)
|
adjust_for_rotation(enum lab_rotation rotation, double *x, double *y)
|
||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
switch (rotation) {
|
switch (rotation) {
|
||||||
|
|
@ -161,7 +162,7 @@ adjust_for_rotation(enum rotation rotation, double *x, double *y)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
adjust_for_rotation_relative(enum rotation rotation, double *dx, double *dy)
|
adjust_for_rotation_relative(enum lab_rotation rotation, double *dx, double *dy)
|
||||||
{
|
{
|
||||||
double tmp;
|
double tmp;
|
||||||
switch (rotation) {
|
switch (rotation) {
|
||||||
|
|
@ -220,11 +221,11 @@ tablet_get_coords(struct drawing_tablet *tablet, struct drawing_tablet_tool *too
|
||||||
/* initialize here to avoid a maybe-uninitialized compiler warning */
|
/* initialize here to avoid a maybe-uninitialized compiler warning */
|
||||||
double lx = -1, ly = -1;
|
double lx = -1, ly = -1;
|
||||||
switch (tool->motion_mode) {
|
switch (tool->motion_mode) {
|
||||||
case LAB_TABLET_MOTION_ABSOLUTE:
|
case LAB_MOTION_ABSOLUTE:
|
||||||
wlr_cursor_absolute_to_layout_coords(tablet->seat->cursor,
|
wlr_cursor_absolute_to_layout_coords(tablet->seat->cursor,
|
||||||
tablet->wlr_input_device, *x, *y, &lx, &ly);
|
tablet->wlr_input_device, *x, *y, &lx, &ly);
|
||||||
break;
|
break;
|
||||||
case LAB_TABLET_MOTION_RELATIVE:
|
case LAB_MOTION_RELATIVE:
|
||||||
/*
|
/*
|
||||||
* Deltas dx,dy will be directly passed into wlr_cursor_move,
|
* Deltas dx,dy will be directly passed into wlr_cursor_move,
|
||||||
* so we can add those directly here to determine our future
|
* so we can add those directly here to determine our future
|
||||||
|
|
@ -262,11 +263,11 @@ notify_motion(struct drawing_tablet *tablet, struct drawing_tablet_tool *tool,
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tool->motion_mode) {
|
switch (tool->motion_mode) {
|
||||||
case LAB_TABLET_MOTION_ABSOLUTE:
|
case LAB_MOTION_ABSOLUTE:
|
||||||
wlr_cursor_warp_absolute(tablet->seat->cursor,
|
wlr_cursor_warp_absolute(tablet->seat->cursor,
|
||||||
tablet->wlr_input_device, x, y);
|
tablet->wlr_input_device, x, y);
|
||||||
break;
|
break;
|
||||||
case LAB_TABLET_MOTION_RELATIVE:
|
case LAB_MOTION_RELATIVE:
|
||||||
wlr_cursor_move(tablet->seat->cursor,
|
wlr_cursor_move(tablet->seat->cursor,
|
||||||
tablet->wlr_input_device, dx, dy);
|
tablet->wlr_input_device, dx, dy);
|
||||||
break;
|
break;
|
||||||
|
|
@ -500,12 +501,12 @@ handle_tablet_tool_axis(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tool->motion_mode) {
|
switch (tool->motion_mode) {
|
||||||
case LAB_TABLET_MOTION_ABSOLUTE:
|
case LAB_MOTION_ABSOLUTE:
|
||||||
cursor_emulate_move_absolute(tablet->seat,
|
cursor_emulate_move_absolute(tablet->seat,
|
||||||
&ev->tablet->base,
|
&ev->tablet->base,
|
||||||
x, y, ev->time_msec);
|
x, y, ev->time_msec);
|
||||||
break;
|
break;
|
||||||
case LAB_TABLET_MOTION_RELATIVE:
|
case LAB_MOTION_RELATIVE:
|
||||||
cursor_emulate_move(tablet->seat,
|
cursor_emulate_move(tablet->seat,
|
||||||
&ev->tablet->base,
|
&ev->tablet->base,
|
||||||
dx, dy, ev->time_msec);
|
dx, dy, ev->time_msec);
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,16 @@
|
||||||
#include <wlr/types/wlr_seat.h>
|
#include <wlr/types/wlr_seat.h>
|
||||||
#include <wlr/types/wlr_touch.h>
|
#include <wlr/types/wlr_touch.h>
|
||||||
#include <linux/input-event-codes.h>
|
#include <linux/input-event-codes.h>
|
||||||
|
#include "action.h"
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/scene-helpers.h"
|
#include "common/scene-helpers.h"
|
||||||
|
#include "config/mousebind.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
|
#include "config/touch.h"
|
||||||
#include "idle.h"
|
#include "idle.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "config/mousebind.h"
|
#include "ssd.h"
|
||||||
#include "action.h"
|
|
||||||
|
|
||||||
/* Holds layout -> surface offsets to report motion events in relative coords */
|
/* Holds layout -> surface offsets to report motion events in relative coords */
|
||||||
struct touch_point {
|
struct touch_point {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "edges.h"
|
#include "edges.h"
|
||||||
#include "input/keyboard.h"
|
#include "input/keyboard.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
@ -166,11 +167,11 @@ interactive_begin(struct view *view, enum input_mode mode, uint32_t edges)
|
||||||
|
|
||||||
bool
|
bool
|
||||||
edge_from_cursor(struct seat *seat, struct output **dest_output,
|
edge_from_cursor(struct seat *seat, struct output **dest_output,
|
||||||
enum view_edge *edge1, enum view_edge *edge2)
|
enum lab_edge *edge1, enum lab_edge *edge2)
|
||||||
{
|
{
|
||||||
*dest_output = NULL;
|
*dest_output = NULL;
|
||||||
*edge1 = VIEW_EDGE_INVALID;
|
*edge1 = LAB_EDGE_INVALID;
|
||||||
*edge2 = VIEW_EDGE_INVALID;
|
*edge2 = LAB_EDGE_INVALID;
|
||||||
|
|
||||||
if (!view_is_floating(seat->server->grabbed_view)) {
|
if (!view_is_floating(seat->server->grabbed_view)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -201,28 +202,28 @@ edge_from_cursor(struct seat *seat, struct output **dest_output,
|
||||||
int right = area->x + area->width - cursor_x;
|
int right = area->x + area->width - cursor_x;
|
||||||
|
|
||||||
if (top < rc.snap_edge_range) {
|
if (top < rc.snap_edge_range) {
|
||||||
*edge1 = VIEW_EDGE_UP;
|
*edge1 = LAB_EDGE_UP;
|
||||||
} else if (bottom < rc.snap_edge_range) {
|
} else if (bottom < rc.snap_edge_range) {
|
||||||
*edge1 = VIEW_EDGE_DOWN;
|
*edge1 = LAB_EDGE_DOWN;
|
||||||
} else if (left < rc.snap_edge_range) {
|
} else if (left < rc.snap_edge_range) {
|
||||||
*edge1 = VIEW_EDGE_LEFT;
|
*edge1 = LAB_EDGE_LEFT;
|
||||||
} else if (right < rc.snap_edge_range) {
|
} else if (right < rc.snap_edge_range) {
|
||||||
*edge1 = VIEW_EDGE_RIGHT;
|
*edge1 = LAB_EDGE_RIGHT;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*edge1 == VIEW_EDGE_UP || *edge1 == VIEW_EDGE_DOWN) {
|
if (*edge1 == LAB_EDGE_UP || *edge1 == LAB_EDGE_DOWN) {
|
||||||
if (left < rc.snap_edge_corner_range) {
|
if (left < rc.snap_edge_corner_range) {
|
||||||
*edge2 = VIEW_EDGE_LEFT;
|
*edge2 = LAB_EDGE_LEFT;
|
||||||
} else if (right < rc.snap_edge_corner_range) {
|
} else if (right < rc.snap_edge_corner_range) {
|
||||||
*edge2 = VIEW_EDGE_RIGHT;
|
*edge2 = LAB_EDGE_RIGHT;
|
||||||
}
|
}
|
||||||
} else if (*edge1 == VIEW_EDGE_LEFT || *edge1 == VIEW_EDGE_RIGHT) {
|
} else if (*edge1 == LAB_EDGE_LEFT || *edge1 == LAB_EDGE_RIGHT) {
|
||||||
if (top < rc.snap_edge_corner_range) {
|
if (top < rc.snap_edge_corner_range) {
|
||||||
*edge2 = VIEW_EDGE_UP;
|
*edge2 = LAB_EDGE_UP;
|
||||||
} else if (bottom < rc.snap_edge_corner_range) {
|
} else if (bottom < rc.snap_edge_corner_range) {
|
||||||
*edge2 = VIEW_EDGE_DOWN;
|
*edge2 = LAB_EDGE_DOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -234,18 +235,18 @@ static bool
|
||||||
snap_to_edge(struct view *view)
|
snap_to_edge(struct view *view)
|
||||||
{
|
{
|
||||||
struct output *output;
|
struct output *output;
|
||||||
enum view_edge edge1, edge2;
|
enum lab_edge edge1, edge2;
|
||||||
if (!edge_from_cursor(&view->server->seat, &output, &edge1, &edge2)) {
|
if (!edge_from_cursor(&view->server->seat, &output, &edge1, &edge2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
enum view_edge edge = edge1 | edge2;
|
enum lab_edge edge = edge1 | edge2;
|
||||||
|
|
||||||
view_set_output(view, output);
|
view_set_output(view, output);
|
||||||
/*
|
/*
|
||||||
* Don't store natural geometry here (it was
|
* Don't store natural geometry here (it was
|
||||||
* stored already in interactive_begin())
|
* stored already in interactive_begin())
|
||||||
*/
|
*/
|
||||||
if (edge == VIEW_EDGE_UP && rc.snap_top_maximize) {
|
if (edge == LAB_EDGE_UP && rc.snap_top_maximize) {
|
||||||
/* <topMaximize> */
|
/* <topMaximize> */
|
||||||
view_maximize(view, VIEW_AXIS_BOTH,
|
view_maximize(view, VIEW_AXIS_BOTH,
|
||||||
/*store_natural_geometry*/ false);
|
/*store_natural_geometry*/ false);
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include <wlr/util/transform.h>
|
#include <wlr/util/transform.h>
|
||||||
#include "common/box.h"
|
#include "common/box.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "common/fd-util.h"
|
#include "common/fd-util.h"
|
||||||
#include "common/font.h"
|
#include "common/font.h"
|
||||||
#include "common/spawn.h"
|
#include "common/spawn.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "config/session.h"
|
#include "config/session.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include "common/spawn.h"
|
#include "common/spawn.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
#include "common/xml.h"
|
#include "common/xml.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "workspaces.h"
|
#include "workspaces.h"
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/scene-helpers.h"
|
#include "common/scene-helpers.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "layers.h"
|
#include "layers.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
|
|
@ -977,7 +978,7 @@ output_nearest_to_cursor(struct server *server)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct output *
|
struct output *
|
||||||
output_get_adjacent(struct output *output, enum view_edge edge, bool wrap)
|
output_get_adjacent(struct output *output, enum lab_edge edge, bool wrap)
|
||||||
{
|
{
|
||||||
if (!output_is_usable(output)) {
|
if (!output_is_usable(output)) {
|
||||||
wlr_log(WLR_ERROR,
|
wlr_log(WLR_ERROR,
|
||||||
|
|
@ -986,7 +987,7 @@ output_get_adjacent(struct output *output, enum view_edge edge, bool wrap)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum wlr_direction direction;
|
enum wlr_direction direction;
|
||||||
if (!direction_from_view_edge(edge, &direction)) {
|
if (!direction_from_edge(edge, &direction)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "common/direction.h"
|
#include "common/direction.h"
|
||||||
#include "common/lab-scene-rect.h"
|
#include "common/lab-scene-rect.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
@ -96,7 +97,7 @@ inactivate_overlay(struct overlay *overlay)
|
||||||
&overlay->edge_rect.tree->node, false);
|
&overlay->edge_rect.tree->node, false);
|
||||||
}
|
}
|
||||||
overlay->active.region = NULL;
|
overlay->active.region = NULL;
|
||||||
overlay->active.edge = VIEW_EDGE_INVALID;
|
overlay->active.edge = LAB_EDGE_INVALID;
|
||||||
overlay->active.output = NULL;
|
overlay->active.output = NULL;
|
||||||
if (overlay->timer) {
|
if (overlay->timer) {
|
||||||
wl_event_source_timer_update(overlay->timer, 0);
|
wl_event_source_timer_update(overlay->timer, 0);
|
||||||
|
|
@ -117,9 +118,9 @@ show_region_overlay(struct seat *seat, struct region *region)
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct wlr_box
|
static struct wlr_box
|
||||||
get_edge_snap_box(enum view_edge edge, struct output *output)
|
get_edge_snap_box(enum lab_edge edge, struct output *output)
|
||||||
{
|
{
|
||||||
if (edge == VIEW_EDGE_UP && rc.snap_top_maximize) {
|
if (edge == LAB_EDGE_UP && rc.snap_top_maximize) {
|
||||||
return output_usable_area_in_layout_coords(output);
|
return output_usable_area_in_layout_coords(output);
|
||||||
} else {
|
} else {
|
||||||
return view_get_edge_snap_box(NULL, output, edge);
|
return view_get_edge_snap_box(NULL, output, edge);
|
||||||
|
|
@ -130,7 +131,7 @@ static int
|
||||||
handle_edge_overlay_timeout(void *data)
|
handle_edge_overlay_timeout(void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = data;
|
struct seat *seat = data;
|
||||||
assert(seat->overlay.active.edge != VIEW_EDGE_INVALID
|
assert(seat->overlay.active.edge != LAB_EDGE_INVALID
|
||||||
&& seat->overlay.active.output);
|
&& seat->overlay.active.output);
|
||||||
struct wlr_box box = get_edge_snap_box(seat->overlay.active.edge,
|
struct wlr_box box = get_edge_snap_box(seat->overlay.active.edge,
|
||||||
seat->overlay.active.output);
|
seat->overlay.active.output);
|
||||||
|
|
@ -140,10 +141,10 @@ handle_edge_overlay_timeout(void *data)
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
edge_has_adjacent_output_from_cursor(struct seat *seat, struct output *output,
|
edge_has_adjacent_output_from_cursor(struct seat *seat, struct output *output,
|
||||||
enum view_edge edge)
|
enum lab_edge edge)
|
||||||
{
|
{
|
||||||
enum wlr_direction dir;
|
enum wlr_direction dir;
|
||||||
if (!direction_from_view_edge(edge, &dir)) {
|
if (!direction_from_edge(edge, &dir)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return wlr_output_layout_adjacent_output(
|
return wlr_output_layout_adjacent_output(
|
||||||
|
|
@ -152,7 +153,7 @@ edge_has_adjacent_output_from_cursor(struct seat *seat, struct output *output,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
show_edge_overlay(struct seat *seat, enum view_edge edge1, enum view_edge edge2,
|
show_edge_overlay(struct seat *seat, enum lab_edge edge1, enum lab_edge edge2,
|
||||||
struct output *output)
|
struct output *output)
|
||||||
{
|
{
|
||||||
if (!rc.snap_overlay_enabled) {
|
if (!rc.snap_overlay_enabled) {
|
||||||
|
|
@ -205,7 +206,7 @@ overlay_update(struct seat *seat)
|
||||||
|
|
||||||
/* Edge-snapping overlay */
|
/* Edge-snapping overlay */
|
||||||
struct output *output;
|
struct output *output;
|
||||||
enum view_edge edge1, edge2;
|
enum lab_edge edge1, edge2;
|
||||||
if (edge_from_cursor(seat, &output, &edge1, &edge2)) {
|
if (edge_from_cursor(seat, &output, &edge1, &edge2)) {
|
||||||
show_edge_overlay(seat, edge1, edge2, output);
|
show_edge_overlay(seat, edge1, edge2, output);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "ssd.h"
|
#include "ssd.h"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "common/list.h"
|
#include "common/list.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "input/keyboard.h"
|
#include "input/keyboard.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@
|
||||||
#include "resize-outlines.h"
|
#include "resize-outlines.h"
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "common/lab-scene-rect.h"
|
#include "common/lab-scene-rect.h"
|
||||||
#include "ssd.h"
|
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
#include "resize-indicator.h"
|
||||||
|
#include "ssd.h"
|
||||||
|
#include "theme.h"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
resize_outlines_enabled(struct view *view)
|
resize_outlines_enabled(struct view *view)
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
|
#include "config/libinput.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
|
#include "config/touch.h"
|
||||||
#include "input/ime.h"
|
#include "input/ime.h"
|
||||||
#include "input/tablet.h"
|
#include "input/tablet.h"
|
||||||
#include "input/tablet-pad.h"
|
#include "input/tablet-pad.h"
|
||||||
|
|
|
||||||
31
src/snap.c
31
src/snap.c
|
|
@ -3,6 +3,7 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
#include "common/border.h"
|
#include "common/border.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "edges.h"
|
#include "edges.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
|
|
@ -50,7 +51,7 @@ check_edge(int *next, struct edge current, struct edge target,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
snap_move_to_edge(struct view *view, enum view_edge direction,
|
snap_move_to_edge(struct view *view, enum lab_edge direction,
|
||||||
bool snap_to_windows, int *dx, int *dy)
|
bool snap_to_windows, int *dx, int *dy)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
@ -79,26 +80,26 @@ snap_move_to_edge(struct view *view, enum view_edge direction,
|
||||||
* needs no further consideration.
|
* needs no further consideration.
|
||||||
*/
|
*/
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case VIEW_EDGE_LEFT:
|
case LAB_EDGE_LEFT:
|
||||||
target.x = usable.x + ssd.left + rc.gap;
|
target.x = usable.x + ssd.left + rc.gap;
|
||||||
if (target.x >= view->pending.x) {
|
if (target.x >= view->pending.x) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_RIGHT:
|
case LAB_EDGE_RIGHT:
|
||||||
target.x = usable.x + usable.width
|
target.x = usable.x + usable.width
|
||||||
- rc.gap - target.width - ssd.right;
|
- rc.gap - target.width - ssd.right;
|
||||||
if (target.x <= view->pending.x) {
|
if (target.x <= view->pending.x) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_UP:
|
case LAB_EDGE_UP:
|
||||||
target.y = usable.y + ssd.top + rc.gap;
|
target.y = usable.y + ssd.top + rc.gap;
|
||||||
if (target.y >= view->pending.y) {
|
if (target.y >= view->pending.y) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_DOWN:
|
case LAB_EDGE_DOWN:
|
||||||
target.y = usable.y + usable.height - rc.gap - ssd.bottom
|
target.y = usable.y + usable.height - rc.gap - ssd.bottom
|
||||||
- view_effective_height(view, /* use_pending */ true);
|
- view_effective_height(view, /* use_pending */ true);
|
||||||
if (target.y <= view->pending.y) {
|
if (target.y <= view->pending.y) {
|
||||||
|
|
@ -133,7 +134,7 @@ snap_move_to_edge(struct view *view, enum view_edge direction,
|
||||||
|
|
||||||
void
|
void
|
||||||
snap_grow_to_next_edge(struct view *view,
|
snap_grow_to_next_edge(struct view *view,
|
||||||
enum view_edge direction, struct wlr_box *geo)
|
enum lab_edge direction, struct wlr_box *geo)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
assert(!view->shaded);
|
assert(!view->shaded);
|
||||||
|
|
@ -152,22 +153,22 @@ snap_grow_to_next_edge(struct view *view,
|
||||||
|
|
||||||
/* First try to grow the view to the relevant edge of its output. */
|
/* First try to grow the view to the relevant edge of its output. */
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case VIEW_EDGE_LEFT:
|
case LAB_EDGE_LEFT:
|
||||||
geo->x = usable.x + ssd.left + rc.gap;
|
geo->x = usable.x + ssd.left + rc.gap;
|
||||||
geo->width = view->pending.x + view->pending.width - geo->x;
|
geo->width = view->pending.x + view->pending.width - geo->x;
|
||||||
resize_edges = WLR_EDGE_LEFT;
|
resize_edges = WLR_EDGE_LEFT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_RIGHT:
|
case LAB_EDGE_RIGHT:
|
||||||
geo->width = usable.x + usable.width
|
geo->width = usable.x + usable.width
|
||||||
- rc.gap - ssd.right - view->pending.x;
|
- rc.gap - ssd.right - view->pending.x;
|
||||||
resize_edges = WLR_EDGE_RIGHT;
|
resize_edges = WLR_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_UP:
|
case LAB_EDGE_UP:
|
||||||
geo->y = usable.y + ssd.top + rc.gap;
|
geo->y = usable.y + ssd.top + rc.gap;
|
||||||
geo->height = view->pending.y + view->pending.height - geo->y;
|
geo->height = view->pending.y + view->pending.height - geo->y;
|
||||||
resize_edges = WLR_EDGE_TOP;
|
resize_edges = WLR_EDGE_TOP;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_DOWN:
|
case LAB_EDGE_DOWN:
|
||||||
geo->height = usable.y + usable.height
|
geo->height = usable.y + usable.height
|
||||||
- rc.gap - ssd.bottom - view->pending.y;
|
- rc.gap - ssd.bottom - view->pending.y;
|
||||||
resize_edges = WLR_EDGE_BOTTOM;
|
resize_edges = WLR_EDGE_BOTTOM;
|
||||||
|
|
@ -213,7 +214,7 @@ snap_grow_to_next_edge(struct view *view,
|
||||||
|
|
||||||
void
|
void
|
||||||
snap_shrink_to_next_edge(struct view *view,
|
snap_shrink_to_next_edge(struct view *view,
|
||||||
enum view_edge direction, struct wlr_box *geo)
|
enum lab_edge direction, struct wlr_box *geo)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
assert(!view->shaded);
|
assert(!view->shaded);
|
||||||
|
|
@ -228,21 +229,21 @@ snap_shrink_to_next_edge(struct view *view,
|
||||||
* minimum size requirements.
|
* minimum size requirements.
|
||||||
*/
|
*/
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case VIEW_EDGE_RIGHT:
|
case LAB_EDGE_RIGHT:
|
||||||
geo->width = MAX(geo->width / 2, min_width);
|
geo->width = MAX(geo->width / 2, min_width);
|
||||||
geo->x = view->pending.x + view->pending.width - geo->width;
|
geo->x = view->pending.x + view->pending.width - geo->width;
|
||||||
resize_edges = WLR_EDGE_LEFT;
|
resize_edges = WLR_EDGE_LEFT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_LEFT:
|
case LAB_EDGE_LEFT:
|
||||||
geo->width = MAX(geo->width / 2, min_width);
|
geo->width = MAX(geo->width / 2, min_width);
|
||||||
resize_edges = WLR_EDGE_RIGHT;
|
resize_edges = WLR_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_DOWN:
|
case LAB_EDGE_DOWN:
|
||||||
geo->height = MAX(geo->height / 2, LAB_MIN_VIEW_HEIGHT);
|
geo->height = MAX(geo->height / 2, LAB_MIN_VIEW_HEIGHT);
|
||||||
geo->y = view->pending.y + view->pending.height - geo->height;
|
geo->y = view->pending.y + view->pending.height - geo->height;
|
||||||
resize_edges = WLR_EDGE_TOP;
|
resize_edges = WLR_EDGE_TOP;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_UP:
|
case LAB_EDGE_UP:
|
||||||
geo->height = MAX(geo->height / 2, LAB_MIN_VIEW_HEIGHT);
|
geo->height = MAX(geo->height / 2, LAB_MIN_VIEW_HEIGHT);
|
||||||
resize_edges = WLR_EDGE_BOTTOM;
|
resize_edges = WLR_EDGE_BOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,11 @@
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/scaled-font-buffer.h"
|
#include "common/scaled-font-buffer.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "resize-indicator.h"
|
#include "resize-indicator.h"
|
||||||
#include "resize-outlines.h"
|
#include "resize-outlines.h"
|
||||||
|
#include "theme.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/scaled-icon-buffer.h"
|
#include "common/scaled-icon-buffer.h"
|
||||||
#include "common/scaled-img-buffer.h"
|
#include "common/scaled-img-buffer.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "ssd-internal.h"
|
#include "ssd-internal.h"
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <cairo.h>
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "labwc.h"
|
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
|
#include "labwc.h"
|
||||||
#include "ssd-internal.h"
|
#include "ssd-internal.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
#include <cairo.h>
|
|
||||||
|
|
||||||
#define FOR_EACH_STATE(ssd, tmp) FOR_EACH(tmp, \
|
#define FOR_EACH_STATE(ssd, tmp) FOR_EACH(tmp, \
|
||||||
&(ssd)->shadow.active, \
|
&(ssd)->shadow.active, \
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,13 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <wlr/render/pixman.h>
|
#include <wlr/render/pixman.h>
|
||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "config.h"
|
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/scaled-font-buffer.h"
|
#include "common/scaled-font-buffer.h"
|
||||||
#include "common/scaled-icon-buffer.h"
|
#include "common/scaled-icon-buffer.h"
|
||||||
#include "common/scaled-img-buffer.h"
|
#include "common/scaled-img-buffer.h"
|
||||||
#include "common/scene-helpers.h"
|
#include "common/scene-helpers.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "desktop-entry.h"
|
#include "desktop-entry.h"
|
||||||
#include "img/img.h"
|
#include "img/img.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
#include <wlr/types/wlr_scene.h>
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/scene-helpers.h"
|
#include "common/scene-helpers.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "ssd-internal.h"
|
#include "ssd-internal.h"
|
||||||
#include "theme.h"
|
#include "theme.h"
|
||||||
|
|
@ -408,7 +409,7 @@ ssd_part_contains(enum ssd_part_type whole, enum ssd_part_type candidate)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ssd_mode
|
enum lab_ssd_mode
|
||||||
ssd_mode_parse(const char *mode)
|
ssd_mode_parse(const char *mode)
|
||||||
{
|
{
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
|
|
|
||||||
108
src/view.c
108
src/view.c
|
|
@ -14,6 +14,7 @@
|
||||||
#include "common/match.h"
|
#include "common/match.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
#include "common/scene-helpers.h"
|
#include "common/scene-helpers.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "foreign-toplevel/foreign.h"
|
#include "foreign-toplevel/foreign.h"
|
||||||
#include "input/keyboard.h"
|
#include "input/keyboard.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
@ -28,6 +29,7 @@
|
||||||
#include "snap-constraints.h"
|
#include "snap-constraints.h"
|
||||||
#include "snap.h"
|
#include "snap.h"
|
||||||
#include "ssd.h"
|
#include "ssd.h"
|
||||||
|
#include "theme.h"
|
||||||
#include "window-rules.h"
|
#include "window-rules.h"
|
||||||
#include "wlr/util/log.h"
|
#include "wlr/util/log.h"
|
||||||
#include "workspaces.h"
|
#include "workspaces.h"
|
||||||
|
|
@ -96,7 +98,7 @@ view_query_free(struct view_query *query)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
query_tristate_match(enum three_state desired, bool actual)
|
query_tristate_match(enum lab_tristate desired, bool actual)
|
||||||
{
|
{
|
||||||
switch (desired) {
|
switch (desired) {
|
||||||
case LAB_STATE_ENABLED:
|
case LAB_STATE_ENABLED:
|
||||||
|
|
@ -169,11 +171,11 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query->tiled == VIEW_EDGE_ANY) {
|
if (query->tiled == LAB_EDGE_ANY) {
|
||||||
if (!view->tiled) {
|
if (!view->tiled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (query->tiled != VIEW_EDGE_INVALID) {
|
} else if (query->tiled != LAB_EDGE_INVALID) {
|
||||||
if (query->tiled != view->tiled) {
|
if (query->tiled != view->tiled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -204,7 +206,7 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ssd_mode decor = view_get_ssd_mode(view);
|
enum lab_ssd_mode decor = view_get_ssd_mode(view);
|
||||||
if (query->decoration != LAB_SSD_MODE_INVALID && query->decoration != decor) {
|
if (query->decoration != LAB_SSD_MODE_INVALID && query->decoration != decor) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -216,11 +218,11 @@ view_matches_query(struct view *view, struct view_query *query)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!strcasecmp(query->monitor, "left") &&
|
if (!strcasecmp(query->monitor, "left") &&
|
||||||
output_get_adjacent(current, VIEW_EDGE_LEFT, false) != view->output) {
|
output_get_adjacent(current, LAB_EDGE_LEFT, false) != view->output) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!strcasecmp(query->monitor, "right") &&
|
if (!strcasecmp(query->monitor, "right") &&
|
||||||
output_get_adjacent(current, VIEW_EDGE_RIGHT, false) != view->output) {
|
output_get_adjacent(current, LAB_EDGE_RIGHT, false) != view->output) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (output_from_name(view->server, query->monitor) != view->output) {
|
if (output_from_name(view->server, query->monitor) != view->output) {
|
||||||
|
|
@ -385,7 +387,7 @@ view_wants_focus(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
view_contains_window_type(struct view *view, enum window_type window_type)
|
view_contains_window_type(struct view *view, enum lab_window_type window_type)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
if (view->impl->contains_window_type) {
|
if (view->impl->contains_window_type) {
|
||||||
|
|
@ -427,28 +429,28 @@ view_offer_focus(struct view *view)
|
||||||
* They may be called repeatably during output layout changes.
|
* They may be called repeatably during output layout changes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum view_edge
|
enum lab_edge
|
||||||
view_edge_invert(enum view_edge edge)
|
view_edge_invert(enum lab_edge edge)
|
||||||
{
|
{
|
||||||
switch (edge) {
|
switch (edge) {
|
||||||
case VIEW_EDGE_LEFT:
|
case LAB_EDGE_LEFT:
|
||||||
return VIEW_EDGE_RIGHT;
|
return LAB_EDGE_RIGHT;
|
||||||
case VIEW_EDGE_RIGHT:
|
case LAB_EDGE_RIGHT:
|
||||||
return VIEW_EDGE_LEFT;
|
return LAB_EDGE_LEFT;
|
||||||
case VIEW_EDGE_UP:
|
case LAB_EDGE_UP:
|
||||||
return VIEW_EDGE_DOWN;
|
return LAB_EDGE_DOWN;
|
||||||
case VIEW_EDGE_DOWN:
|
case LAB_EDGE_DOWN:
|
||||||
return VIEW_EDGE_UP;
|
return LAB_EDGE_UP;
|
||||||
case VIEW_EDGE_CENTER:
|
case LAB_EDGE_CENTER:
|
||||||
case VIEW_EDGE_INVALID:
|
case LAB_EDGE_INVALID:
|
||||||
default:
|
default:
|
||||||
return VIEW_EDGE_INVALID;
|
return LAB_EDGE_INVALID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_box
|
struct wlr_box
|
||||||
view_get_edge_snap_box(struct view *view, struct output *output,
|
view_get_edge_snap_box(struct view *view, struct output *output,
|
||||||
enum view_edge edge)
|
enum lab_edge edge)
|
||||||
{
|
{
|
||||||
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
struct wlr_box usable = output_usable_area_in_layout_coords(output);
|
||||||
int x1 = rc.gap;
|
int x1 = rc.gap;
|
||||||
|
|
@ -456,16 +458,16 @@ view_get_edge_snap_box(struct view *view, struct output *output,
|
||||||
int x2 = usable.width - rc.gap;
|
int x2 = usable.width - rc.gap;
|
||||||
int y2 = usable.height - rc.gap;
|
int y2 = usable.height - rc.gap;
|
||||||
|
|
||||||
if (edge & VIEW_EDGE_RIGHT) {
|
if (edge & LAB_EDGE_RIGHT) {
|
||||||
x1 = (usable.width + rc.gap) / 2;
|
x1 = (usable.width + rc.gap) / 2;
|
||||||
}
|
}
|
||||||
if (edge & VIEW_EDGE_LEFT) {
|
if (edge & LAB_EDGE_LEFT) {
|
||||||
x2 = (usable.width - rc.gap) / 2;
|
x2 = (usable.width - rc.gap) / 2;
|
||||||
}
|
}
|
||||||
if (edge & VIEW_EDGE_DOWN) {
|
if (edge & LAB_EDGE_DOWN) {
|
||||||
y1 = (usable.height + rc.gap) / 2;
|
y1 = (usable.height + rc.gap) / 2;
|
||||||
}
|
}
|
||||||
if (edge & VIEW_EDGE_UP) {
|
if (edge & LAB_EDGE_UP) {
|
||||||
y2 = (usable.height - rc.gap) / 2;
|
y2 = (usable.height - rc.gap) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1115,7 +1117,7 @@ view_cascade(struct view *view)
|
||||||
|
|
||||||
void
|
void
|
||||||
view_place_by_policy(struct view *view, bool allow_cursor,
|
view_place_by_policy(struct view *view, bool allow_cursor,
|
||||||
enum view_placement_policy policy)
|
enum lab_placement_policy policy)
|
||||||
{
|
{
|
||||||
if (allow_cursor && policy == LAB_PLACE_CURSOR) {
|
if (allow_cursor && policy == LAB_PLACE_CURSOR) {
|
||||||
view_move_to_cursor(view);
|
view_move_to_cursor(view);
|
||||||
|
|
@ -1458,7 +1460,7 @@ void
|
||||||
view_set_untiled(struct view *view)
|
view_set_untiled(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
view->tiled = VIEW_EDGE_INVALID;
|
view->tiled = LAB_EDGE_INVALID;
|
||||||
view->tiled_region = NULL;
|
view->tiled_region = NULL;
|
||||||
zfree(view->tiled_region_evacuate);
|
zfree(view->tiled_region_evacuate);
|
||||||
view_notify_tiled(view);
|
view_notify_tiled(view);
|
||||||
|
|
@ -1569,7 +1571,7 @@ view_wants_decorations(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_set_decorations(struct view *view, enum ssd_mode mode, bool force_ssd)
|
view_set_decorations(struct view *view, enum lab_ssd_mode mode, bool force_ssd)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
|
|
@ -1584,7 +1586,7 @@ view_toggle_decorations(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
enum ssd_mode mode = view_get_ssd_mode(view);
|
enum lab_ssd_mode mode = view_get_ssd_mode(view);
|
||||||
if (rc.ssd_keep_border && mode == LAB_SSD_MODE_FULL) {
|
if (rc.ssd_keep_border && mode == LAB_SSD_MODE_FULL) {
|
||||||
view_set_ssd_mode(view, LAB_SSD_MODE_BORDER);
|
view_set_ssd_mode(view, LAB_SSD_MODE_BORDER);
|
||||||
} else if (mode != LAB_SSD_MODE_NONE) {
|
} else if (mode != LAB_SSD_MODE_NONE) {
|
||||||
|
|
@ -1674,7 +1676,7 @@ undecorate(struct view *view)
|
||||||
view->ssd = NULL;
|
view->ssd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ssd_mode
|
enum lab_ssd_mode
|
||||||
view_get_ssd_mode(struct view *view)
|
view_get_ssd_mode(struct view *view)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
@ -1689,7 +1691,7 @@ view_get_ssd_mode(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_set_ssd_mode(struct view *view, enum ssd_mode mode)
|
view_set_ssd_mode(struct view *view, enum lab_ssd_mode mode)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
|
|
@ -1974,7 +1976,7 @@ shift_view_to_usable_1d(int size,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_move_to_edge(struct view *view, enum view_edge direction, bool snap_to_windows)
|
view_move_to_edge(struct view *view, enum lab_edge direction, bool snap_to_windows)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
if (!output_is_usable(view->output)) {
|
if (!output_is_usable(view->output)) {
|
||||||
|
|
@ -2020,16 +2022,16 @@ view_move_to_edge(struct view *view, enum view_edge direction, bool snap_to_wind
|
||||||
/* Compute the new position in the direction of motion */
|
/* Compute the new position in the direction of motion */
|
||||||
direction = view_edge_invert(direction);
|
direction = view_edge_invert(direction);
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case VIEW_EDGE_LEFT:
|
case LAB_EDGE_LEFT:
|
||||||
destination_x = left;
|
destination_x = left;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_RIGHT:
|
case LAB_EDGE_RIGHT:
|
||||||
destination_x = right - view->pending.width;
|
destination_x = right - view->pending.width;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_UP:
|
case LAB_EDGE_UP:
|
||||||
destination_y = top;
|
destination_y = top;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_DOWN:
|
case LAB_EDGE_DOWN:
|
||||||
destination_y = bottom
|
destination_y = bottom
|
||||||
- view_effective_height(view, /* use_pending */ true);
|
- view_effective_height(view, /* use_pending */ true);
|
||||||
break;
|
break;
|
||||||
|
|
@ -2057,7 +2059,7 @@ view_move_to_edge(struct view *view, enum view_edge direction, bool snap_to_wind
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_grow_to_edge(struct view *view, enum view_edge direction)
|
view_grow_to_edge(struct view *view, enum lab_edge direction)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
/* TODO: allow grow to edge if maximized along the other axis */
|
/* TODO: allow grow to edge if maximized along the other axis */
|
||||||
|
|
@ -2078,7 +2080,7 @@ view_grow_to_edge(struct view *view, enum view_edge direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_shrink_to_edge(struct view *view, enum view_edge direction)
|
view_shrink_to_edge(struct view *view, enum lab_edge direction)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
|
|
@ -2118,46 +2120,46 @@ view_axis_parse(const char *direction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum view_edge
|
enum lab_edge
|
||||||
view_edge_parse(const char *direction, bool tiled, bool any)
|
view_edge_parse(const char *direction, bool tiled, bool any)
|
||||||
{
|
{
|
||||||
if (!direction) {
|
if (!direction) {
|
||||||
return VIEW_EDGE_INVALID;
|
return LAB_EDGE_INVALID;
|
||||||
}
|
}
|
||||||
if (!strcasecmp(direction, "left")) {
|
if (!strcasecmp(direction, "left")) {
|
||||||
return VIEW_EDGE_LEFT;
|
return LAB_EDGE_LEFT;
|
||||||
} else if (!strcasecmp(direction, "up")) {
|
} else if (!strcasecmp(direction, "up")) {
|
||||||
return VIEW_EDGE_UP;
|
return LAB_EDGE_UP;
|
||||||
} else if (!strcasecmp(direction, "right")) {
|
} else if (!strcasecmp(direction, "right")) {
|
||||||
return VIEW_EDGE_RIGHT;
|
return LAB_EDGE_RIGHT;
|
||||||
} else if (!strcasecmp(direction, "down")) {
|
} else if (!strcasecmp(direction, "down")) {
|
||||||
return VIEW_EDGE_DOWN;
|
return LAB_EDGE_DOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (any) {
|
if (any) {
|
||||||
if (!strcasecmp(direction, "any")) {
|
if (!strcasecmp(direction, "any")) {
|
||||||
return VIEW_EDGE_ANY;
|
return LAB_EDGE_ANY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tiled) {
|
if (tiled) {
|
||||||
if (!strcasecmp(direction, "center")) {
|
if (!strcasecmp(direction, "center")) {
|
||||||
return VIEW_EDGE_CENTER;
|
return LAB_EDGE_CENTER;
|
||||||
} else if (!strcasecmp(direction, "up-left")) {
|
} else if (!strcasecmp(direction, "up-left")) {
|
||||||
return VIEW_EDGE_UPLEFT;
|
return LAB_EDGE_UPLEFT;
|
||||||
} else if (!strcasecmp(direction, "up-right")) {
|
} else if (!strcasecmp(direction, "up-right")) {
|
||||||
return VIEW_EDGE_UPRIGHT;
|
return LAB_EDGE_UPRIGHT;
|
||||||
} else if (!strcasecmp(direction, "down-left")) {
|
} else if (!strcasecmp(direction, "down-left")) {
|
||||||
return VIEW_EDGE_DOWNLEFT;
|
return LAB_EDGE_DOWNLEFT;
|
||||||
} else if (!strcasecmp(direction, "down-right")) {
|
} else if (!strcasecmp(direction, "down-right")) {
|
||||||
return VIEW_EDGE_DOWNRIGHT;
|
return LAB_EDGE_DOWNRIGHT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return VIEW_EDGE_INVALID;
|
return LAB_EDGE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum view_placement_policy
|
enum lab_placement_policy
|
||||||
view_placement_parse(const char *policy)
|
view_placement_parse(const char *policy)
|
||||||
{
|
{
|
||||||
if (!policy) {
|
if (!policy) {
|
||||||
|
|
@ -2178,7 +2180,7 @@ view_placement_parse(const char *policy)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view_snap_to_edge(struct view *view, enum view_edge edge,
|
view_snap_to_edge(struct view *view, enum lab_edge edge,
|
||||||
bool across_outputs, bool store_natural_geometry)
|
bool across_outputs, bool store_natural_geometry)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,13 @@
|
||||||
#include "common/graphic-helpers.h"
|
#include "common/graphic-helpers.h"
|
||||||
#include "common/list.h"
|
#include "common/list.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "input/keyboard.h"
|
#include "input/keyboard.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "protocols/cosmic-workspaces.h"
|
#include "protocols/cosmic-workspaces.h"
|
||||||
#include "protocols/ext-workspace.h"
|
#include "protocols/ext-workspace.h"
|
||||||
|
#include "theme.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
#define COSMIC_WORKSPACES_VERSION 1
|
#define COSMIC_WORKSPACES_VERSION 1
|
||||||
|
|
|
||||||
25
src/xdg.c
25
src/xdg.c
|
|
@ -9,6 +9,7 @@
|
||||||
#include "common/array.h"
|
#include "common/array.h"
|
||||||
#include "common/macros.h"
|
#include "common/macros.h"
|
||||||
#include "common/mem.h"
|
#include "common/mem.h"
|
||||||
|
#include "config/rcxml.h"
|
||||||
#include "decorations.h"
|
#include "decorations.h"
|
||||||
#include "foreign-toplevel/foreign.h"
|
#include "foreign-toplevel/foreign.h"
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
@ -66,7 +67,7 @@ xdg_toplevel_view_get_size_hints(struct view *view)
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
xdg_toplevel_view_contains_window_type(struct view *view,
|
xdg_toplevel_view_contains_window_type(struct view *view,
|
||||||
enum window_type window_type)
|
enum lab_window_type window_type)
|
||||||
{
|
{
|
||||||
assert(view);
|
assert(view);
|
||||||
|
|
||||||
|
|
@ -78,9 +79,9 @@ xdg_toplevel_view_contains_window_type(struct view *view,
|
||||||
|| toplevel->parent;
|
|| toplevel->parent;
|
||||||
|
|
||||||
switch (window_type) {
|
switch (window_type) {
|
||||||
case NET_WM_WINDOW_TYPE_NORMAL:
|
case LAB_WINDOW_TYPE_NORMAL:
|
||||||
return !is_dialog;
|
return !is_dialog;
|
||||||
case NET_WM_WINDOW_TYPE_DIALOG:
|
case LAB_WINDOW_TYPE_DIALOG:
|
||||||
return is_dialog;
|
return is_dialog;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -663,31 +664,31 @@ xdg_toplevel_view_notify_tiled(struct view *view)
|
||||||
*/
|
*/
|
||||||
if (want_edge) {
|
if (want_edge) {
|
||||||
switch (view->tiled) {
|
switch (view->tiled) {
|
||||||
case VIEW_EDGE_LEFT:
|
case LAB_EDGE_LEFT:
|
||||||
edge = WLR_EDGE_LEFT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM;
|
edge = WLR_EDGE_LEFT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_RIGHT:
|
case LAB_EDGE_RIGHT:
|
||||||
edge = WLR_EDGE_RIGHT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM;
|
edge = WLR_EDGE_RIGHT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_UP:
|
case LAB_EDGE_UP:
|
||||||
edge = WLR_EDGE_TOP | WLR_EDGE_LEFT | WLR_EDGE_RIGHT;
|
edge = WLR_EDGE_TOP | WLR_EDGE_LEFT | WLR_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_DOWN:
|
case LAB_EDGE_DOWN:
|
||||||
edge = WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT;
|
edge = WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_UPLEFT:
|
case LAB_EDGE_UPLEFT:
|
||||||
edge = WLR_EDGE_TOP | WLR_EDGE_LEFT;
|
edge = WLR_EDGE_TOP | WLR_EDGE_LEFT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_UPRIGHT:
|
case LAB_EDGE_UPRIGHT:
|
||||||
edge = WLR_EDGE_TOP | WLR_EDGE_RIGHT;
|
edge = WLR_EDGE_TOP | WLR_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_DOWNLEFT:
|
case LAB_EDGE_DOWNLEFT:
|
||||||
edge = WLR_EDGE_BOTTOM | WLR_EDGE_LEFT;
|
edge = WLR_EDGE_BOTTOM | WLR_EDGE_LEFT;
|
||||||
break;
|
break;
|
||||||
case VIEW_EDGE_DOWNRIGHT:
|
case LAB_EDGE_DOWNRIGHT:
|
||||||
edge = WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT;
|
edge = WLR_EDGE_BOTTOM | WLR_EDGE_RIGHT;
|
||||||
break;
|
break;
|
||||||
/* TODO: VIEW_EDGE_CENTER? */
|
/* TODO: LAB_EDGE_CENTER? */
|
||||||
default:
|
default:
|
||||||
edge = WLR_EDGE_NONE;
|
edge = WLR_EDGE_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,40 +41,40 @@ static void xwayland_view_unmap(struct view *view, bool client_request);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
xwayland_view_contains_window_type(struct view *view,
|
xwayland_view_contains_window_type(struct view *view,
|
||||||
enum window_type window_type)
|
enum lab_window_type window_type)
|
||||||
{
|
{
|
||||||
/* Compile-time check that the enum types match */
|
/* Compile-time check that the enum types match */
|
||||||
static_assert(NET_WM_WINDOW_TYPE_DESKTOP ==
|
static_assert(LAB_WINDOW_TYPE_DESKTOP ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DESKTOP
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DESKTOP
|
||||||
&& NET_WM_WINDOW_TYPE_DOCK ==
|
&& LAB_WINDOW_TYPE_DOCK ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DOCK
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DOCK
|
||||||
&& NET_WM_WINDOW_TYPE_TOOLBAR ==
|
&& LAB_WINDOW_TYPE_TOOLBAR ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLBAR
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLBAR
|
||||||
&& NET_WM_WINDOW_TYPE_MENU ==
|
&& LAB_WINDOW_TYPE_MENU ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_MENU
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_MENU
|
||||||
&& NET_WM_WINDOW_TYPE_UTILITY ==
|
&& LAB_WINDOW_TYPE_UTILITY ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY
|
||||||
&& NET_WM_WINDOW_TYPE_SPLASH ==
|
&& LAB_WINDOW_TYPE_SPLASH ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH
|
||||||
&& NET_WM_WINDOW_TYPE_DIALOG ==
|
&& LAB_WINDOW_TYPE_DIALOG ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DIALOG
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DIALOG
|
||||||
&& NET_WM_WINDOW_TYPE_DROPDOWN_MENU ==
|
&& LAB_WINDOW_TYPE_DROPDOWN_MENU ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DROPDOWN_MENU
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DROPDOWN_MENU
|
||||||
&& NET_WM_WINDOW_TYPE_POPUP_MENU ==
|
&& LAB_WINDOW_TYPE_POPUP_MENU ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_POPUP_MENU
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_POPUP_MENU
|
||||||
&& NET_WM_WINDOW_TYPE_TOOLTIP ==
|
&& LAB_WINDOW_TYPE_TOOLTIP ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLTIP
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLTIP
|
||||||
&& NET_WM_WINDOW_TYPE_NOTIFICATION ==
|
&& LAB_WINDOW_TYPE_NOTIFICATION ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NOTIFICATION
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NOTIFICATION
|
||||||
&& NET_WM_WINDOW_TYPE_COMBO ==
|
&& LAB_WINDOW_TYPE_COMBO ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_COMBO
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_COMBO
|
||||||
&& NET_WM_WINDOW_TYPE_DND ==
|
&& LAB_WINDOW_TYPE_DND ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DND
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DND
|
||||||
&& NET_WM_WINDOW_TYPE_NORMAL ==
|
&& LAB_WINDOW_TYPE_NORMAL ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NORMAL
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NORMAL
|
||||||
&& WINDOW_TYPE_LEN ==
|
&& LAB_WINDOW_TYPE_LEN ==
|
||||||
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NORMAL + 1,
|
(int)WLR_XWAYLAND_NET_WM_WINDOW_TYPE_NORMAL + 1,
|
||||||
"enum window_type does not match wlr_xwayland_net_wm_window_type");
|
"lab_window_type does not match wlr_xwayland_net_wm_window_type");
|
||||||
|
|
||||||
assert(view);
|
assert(view);
|
||||||
struct wlr_xwayland_surface *surface = xwayland_surface_from_view(view);
|
struct wlr_xwayland_surface *surface = xwayland_surface_from_view(view);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue