Merge branch 'main' into feature/dual-row-scroller

This commit is contained in:
rasmusq
2025-12-04 16:26:20 +01:00
22 changed files with 472 additions and 421 deletions

View File

@@ -181,6 +181,28 @@ enum seat_config_shortcuts_inhibit {
SHORTCUTS_INHIBIT_ENABLE,
};
// 事件掩码枚举
enum print_event_type {
PRINT_ACTIVE = 1 << 0,
PRINT_TAG = 1 << 1,
PRINT_LAYOUT = 1 << 2,
PRINT_TITLE = 1 << 3,
PRINT_APPID = 1 << 4,
PRINT_LAYOUT_SYMBOL = 1 << 5,
PRINT_FULLSCREEN = 1 << 6,
PRINT_FLOATING = 1 << 7,
PRINT_X = 1 << 8,
PRINT_Y = 1 << 9,
PRINT_WIDTH = 1 << 10,
PRINT_HEIGHT = 1 << 11,
PRINT_LAST_LAYER = 1 << 12,
PRINT_KB_LAYOUT = 1 << 13,
PRINT_KEYMODE = 1 << 14,
PRINT_SCALEFACTOR = 1 << 15,
PRINT_FRAME = 1 << 16,
PRINT_ALL = (1 << 17) - 1 // 所有位都设为1
};
typedef struct Pertag Pertag;
typedef struct Monitor Monitor;
typedef struct Client Client;
@@ -201,13 +223,13 @@ typedef struct {
char *v;
char *v2;
char *v3;
unsigned int ui;
unsigned int ui2;
uint32_t ui;
uint32_t ui2;
} Arg;
typedef struct {
unsigned int mod;
unsigned int button;
uint32_t mod;
uint32_t button;
int (*func)(const Arg *);
const Arg arg;
} Button; // 鼠标按键
@@ -218,8 +240,8 @@ typedef struct {
} KeyMode;
typedef struct {
unsigned int mod;
unsigned int dir;
uint32_t mod;
uint32_t dir;
int (*func)(const Arg *);
const Arg arg;
} Axis;
@@ -247,8 +269,8 @@ struct dwl_animation {
bool tagouting;
bool begin_fade_in;
bool tag_from_rule;
unsigned int time_started;
unsigned int duration;
uint32_t time_started;
uint32_t duration;
struct wlr_box initial;
struct wlr_box current;
int action;
@@ -259,8 +281,8 @@ struct dwl_opacity_animation {
float current_opacity;
float target_opacity;
float initial_opacity;
unsigned int time_started;
unsigned int duration;
uint32_t time_started;
uint32_t duration;
float current_border_color[4];
float target_border_color[4];
float initial_border_color[4];
@@ -277,7 +299,7 @@ typedef struct {
struct Client {
/* Must keep these three elements in this order */
unsigned int type; /* XDGShell or X11* */
uint32_t type; /* XDGShell or X11* */
struct wlr_box geom, pending, float_geom, animainit_geom,
overview_backup_geom, current,
drag_begin_geom; /* layout-relative, includes border */
@@ -309,10 +331,10 @@ struct Client {
struct wl_listener set_hints;
struct wl_listener set_geometry;
#endif
unsigned int bw;
unsigned int tags, oldtags, mini_restore_tag;
uint32_t bw;
uint32_t tags, oldtags, mini_restore_tag;
bool dirty;
unsigned int configure_serial;
uint32_t configure_serial;
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
int isfloating, isurgent, isfullscreen, isfakefullscreen,
need_float_size_reduce, isminimized, isoverlay, isnosizehint,
@@ -381,6 +403,7 @@ struct Client {
int force_tearing;
int allow_shortcuts_inhibit;
float scroller_proportion_single;
bool isfocusing;
};
typedef struct {
@@ -390,7 +413,7 @@ typedef struct {
} DwlIpcOutput;
typedef struct {
unsigned int mod;
uint32_t mod;
xkb_keysym_t keysym;
int (*func)(const Arg *);
const Arg arg;
@@ -401,8 +424,8 @@ typedef struct {
int nsyms;
const xkb_keysym_t *keysyms; /* invalid if nsyms == 0 */
unsigned int mods; /* invalid if nsyms == 0 */
unsigned int keycode;
uint32_t mods; /* invalid if nsyms == 0 */
uint32_t keycode;
struct wl_event_source *key_repeat_source;
struct wl_listener modifiers;
@@ -418,7 +441,7 @@ typedef struct {
typedef struct {
/* Must keep these three elements in this order */
unsigned int type; /* LayerShell */
uint32_t type; /* LayerShell */
struct wlr_box geom, current, pending, animainit_geom;
Monitor *mon;
struct wlr_scene_tree *scene;
@@ -449,7 +472,7 @@ typedef struct {
const char *symbol;
void (*arrange)(Monitor *);
const char *name;
unsigned int id;
uint32_t id;
} Layout;
struct Monitor {
@@ -466,8 +489,8 @@ struct Monitor {
struct wlr_box w; /* window area, layout-relative */
struct wl_list layers[4]; /* LayerSurface::link */
const Layout *lt;
unsigned int seltags;
unsigned int tagset[2];
uint32_t seltags;
uint32_t tagset[2];
double mfact;
int nmaster;
@@ -481,9 +504,9 @@ struct Monitor {
int isoverview;
int is_in_hotarea;
int asleep;
unsigned int visible_clients;
unsigned int visible_tiling_clients;
unsigned int visible_scroll_tiling_clients;
uint32_t visible_clients;
uint32_t visible_tiling_clients;
uint32_t visible_scroll_tiling_clients;
bool has_visible_fullscreen_client;
struct wlr_scene_optimized_blur *blur;
char last_surface_ws_name[256];
@@ -515,7 +538,7 @@ arrange(Monitor *m,
static void arrangelayer(Monitor *m, struct wl_list *list,
struct wlr_box *usable_area, int exclusive);
static void arrangelayers(Monitor *m);
static char *get_autostart_path(char *, unsigned int); // 自启动命令执行
static void handle_print_status(struct wl_listener *listener, void *data);
static void axisnotify(struct wl_listener *listener,
void *data); // 滚轮事件处理
static void buttonpress(struct wl_listener *listener,
@@ -580,21 +603,20 @@ static void gpureset(struct wl_listener *listener, void *data);
static int keyrepeat(void *data);
static void inputdevice(struct wl_listener *listener, void *data);
static int keybinding(unsigned int state, bool locked, unsigned int mods,
xkb_keysym_t sym, unsigned int keycode);
static int keybinding(uint32_t state, bool locked, uint32_t mods,
xkb_keysym_t sym, uint32_t keycode);
static void keypress(struct wl_listener *listener, void *data);
static void keypressmod(struct wl_listener *listener, void *data);
static bool keypressglobal(struct wlr_surface *last_surface,
struct wlr_keyboard *keyboard,
struct wlr_keyboard_key_event *event,
unsigned int mods, xkb_keysym_t keysym,
unsigned int keycode);
struct wlr_keyboard_key_event *event, uint32_t mods,
xkb_keysym_t keysym, uint32_t keycode);
static void locksession(struct wl_listener *listener, void *data);
static void mapnotify(struct wl_listener *listener, void *data);
static void maximizenotify(struct wl_listener *listener, void *data);
static void minimizenotify(struct wl_listener *listener, void *data);
static void motionabsolute(struct wl_listener *listener, void *data);
static void motionnotify(unsigned int time, struct wlr_input_device *device,
static void motionnotify(uint32_t time, struct wlr_input_device *device,
double sx, double sy, double sx_unaccel,
double sy_unaccel);
static void motionrelative(struct wl_listener *listener, void *data);
@@ -608,7 +630,7 @@ static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config,
int test);
static void outputmgrtest(struct wl_listener *listener, void *data);
static void pointerfocus(Client *c, struct wlr_surface *surface, double sx,
double sy, unsigned int time);
double sy, uint32_t time);
static void printstatus(void);
static void quitsignal(int signo);
static void powermgrsetmode(struct wl_listener *listener, void *data);
@@ -626,7 +648,7 @@ static void setmaximizescreen(Client *c, int maximizescreen);
static void reset_maximizescreen_size(Client *c);
static void setgaps(int oh, int ov, int ih, int iv);
static void setmon(Client *c, Monitor *m, unsigned int newtags, bool focus);
static void setmon(Client *c, Monitor *m, uint32_t newtags, bool focus);
static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data);
static void setup(void);
@@ -657,7 +679,7 @@ static Client *termforwin(Client *w);
static void swallow(Client *c, Client *w);
static void warp_cursor_to_selmon(Monitor *m);
unsigned int want_restore_fullscreen(Client *target_client);
uint32_t want_restore_fullscreen(Client *target_client);
static void overview_restore(Client *c, const Arg *arg);
static void overview_backup(Client *c);
static int applyrulesgeom(Client *c);
@@ -670,7 +692,7 @@ static void tag_client(const Arg *arg, Client *target_client);
static struct wlr_box setclient_coordinate_center(Client *c,
struct wlr_box geom,
int offsetx, int offsety);
static unsigned int get_tags_first_tag(unsigned int tags);
static uint32_t get_tags_first_tag(uint32_t tags);
static struct wlr_output_mode *
get_nearest_output_mode(struct wlr_output *output, int width, int height,
@@ -701,11 +723,11 @@ static bool check_hit_no_border(Client *c);
static void reset_keyboard_layout(void);
static void client_update_oldmonname_record(Client *c, Monitor *m);
static void pending_kill_client(Client *c);
static unsigned int get_tags_first_tag_num(unsigned int source_tags);
static uint32_t get_tags_first_tag_num(uint32_t source_tags);
static void set_layer_open_animaiton(LayerSurface *l, struct wlr_box geo);
static void init_fadeout_layers(LayerSurface *l);
static void layer_actual_size(LayerSurface *l, unsigned int *width,
unsigned int *height);
static void layer_actual_size(LayerSurface *l, uint32_t *width,
uint32_t *height);
static void get_layer_target_geometry(LayerSurface *l,
struct wlr_box *target_box);
static void scene_buffer_apply_effect(struct wlr_scene_buffer *buffer, int sx,
@@ -728,13 +750,13 @@ static Client *get_client_by_id_or_title(const char *arg_id,
const char *arg_title);
static bool switch_scratchpad_client_state(Client *c);
static bool check_trackpad_disabled(struct wlr_pointer *pointer);
static unsigned int get_tag_status(unsigned int tag, Monitor *m);
static uint32_t get_tag_status(uint32_t tag, Monitor *m);
static void enable_adaptive_sync(Monitor *m, struct wlr_output_state *state);
static Client *get_next_stack_client(Client *c, bool reverse);
static void set_float_malposition(Client *tc);
static void set_size_per(Monitor *m, Client *c);
static void resize_tile_client(Client *grabc, bool isdrag, int offsetx,
int offsety, unsigned int time);
int offsety, uint32_t time);
static void refresh_monitors_workspaces_status(Monitor *m);
static void init_client_properties(Client *c);
static float *get_border_color(Client *c);
@@ -749,7 +771,7 @@ static void clear_fullscreen_and_maximized_state(Monitor *m);
static const char broken[] = "broken";
static pid_t child_pid = -1;
static int locked;
static unsigned int locked_mods = 0;
static uint32_t locked_mods = 0;
static void *exclusive_focus;
static struct wl_display *dpy;
static struct wl_event_loop *event_loop;
@@ -779,6 +801,7 @@ static struct wlr_virtual_pointer_manager_v1 *virtual_pointer_mgr;
static struct wlr_output_power_manager_v1 *power_mgr;
static struct wlr_pointer_gestures_v1 *pointer_gestures;
static struct wlr_drm_lease_v1_manager *drm_lease_manager;
struct mango_print_status_manager *print_status_manager;
static struct wlr_cursor *cursor;
static struct wlr_xcursor_manager *cursor_mgr;
@@ -799,7 +822,7 @@ static struct wlr_seat *seat;
static KeyboardGroup *kb_group;
static struct wl_list inputdevices;
static struct wl_list keyboard_shortcut_inhibitors;
static unsigned int cursor_mode;
static uint32_t cursor_mode;
static Client *grabc;
static int grabcx, grabcy; /* client-relative */
static int drag_begin_cursorx, drag_begin_cursory; /* client-relative */
@@ -816,7 +839,7 @@ static int axis_apply_time = 0;
static int axis_apply_dir = 0;
static int scroller_focus_lock = 0;
static unsigned int swipe_fingers = 0;
static uint32_t swipe_fingers = 0;
static double swipe_dx = 0;
static double swipe_dy = 0;
@@ -831,6 +854,7 @@ struct dvec2 *baked_points_focus;
static struct wl_event_source *hide_source;
static bool cursor_hidden = false;
static bool tag_combo = false;
static const char *cli_config_path = NULL;
static KeyMode keymode = {
.mode = {'d', 'e', 'f', 'a', 'u', 'l', 't', '\0'},
.isdefault = true,
@@ -846,7 +870,7 @@ static struct {
#include "config/preset.h"
struct Pertag {
unsigned int curtag, prevtag; /* current and previous tag */
uint32_t curtag, prevtag; /* current and previous tag */
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
bool no_hide[LENGTH(tags) + 1]; /* no_hide per tag */
@@ -854,6 +878,10 @@ struct Pertag {
*ltidxs[LENGTH(tags) + 1]; /* matrix of tags and layouts indexes */
};
static struct wl_signal mango_print_status;
static struct wl_listener print_status_listener = {.notify =
handle_print_status};
static struct wl_listener cursor_axis = {.notify = axisnotify};
static struct wl_listener cursor_button = {.notify = buttonpress};
static struct wl_listener cursor_frame = {.notify = cursorframe};
@@ -1291,7 +1319,7 @@ void set_float_malposition(Client *tc) {
void applyrules(Client *c) {
/* rule matching */
const char *appid, *title;
unsigned int i, newtags = 0;
uint32_t i, newtags = 0;
const ConfigWinRule *r;
Monitor *m = NULL;
Client *fc = NULL;
@@ -1466,9 +1494,9 @@ void apply_window_snap(Client *c) {
int snap_up_mon = 0, snap_down_mon = 0, snap_left_mon = 0,
snap_right_mon = 0;
unsigned int cbw = !render_border || c->fake_no_border ? borderpx : 0;
unsigned int tcbw;
unsigned int cx, cy, cw, ch, tcx, tcy, tcw, tch;
uint32_t cbw = !render_border || c->fake_no_border ? borderpx : 0;
uint32_t tcbw;
uint32_t cx, cy, cw, ch, tcx, tcy, tcw, tch;
cx = c->geom.x + cbw;
cy = c->geom.y + cbw;
cw = c->geom.width - 2 * cbw;
@@ -1568,7 +1596,7 @@ void focuslayer(LayerSurface *l) {
void reset_exclusive_layer(Monitor *m) {
LayerSurface *l = NULL;
int i;
unsigned int layers_above_shell[] = {
uint32_t layers_above_shell[] = {
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY,
ZWLR_LAYER_SHELL_V1_LAYER_TOP,
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM,
@@ -1633,10 +1661,10 @@ axisnotify(struct wl_listener *listener, void *data) {
* for example when you move the scroll wheel. */
struct wlr_pointer_axis_event *event = data;
struct wlr_keyboard *keyboard, *hard_keyboard;
unsigned int mods, hard_mods;
uint32_t mods, hard_mods;
AxisBinding *a;
int ji;
unsigned int adir;
uint32_t adir;
// IDLE_NOTIFY_ACTIVITY;
handlecursoractivity();
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
@@ -1690,11 +1718,11 @@ axisnotify(struct wl_listener *listener, void *data) {
int ongesture(struct wlr_pointer_swipe_end_event *event) {
struct wlr_keyboard *keyboard, *hard_keyboard;
unsigned int mods, hard_mods;
uint32_t mods, hard_mods;
const GestureBinding *g;
unsigned int motion;
unsigned int adx = (int)round(fabs(swipe_dx));
unsigned int ady = (int)round(fabs(swipe_dy));
uint32_t motion;
uint32_t adx = (int)round(fabs(swipe_dx));
uint32_t ady = (int)round(fabs(swipe_dy));
int handled = 0;
int ji;
@@ -1859,7 +1887,7 @@ void // 鼠标按键事件
buttonpress(struct wl_listener *listener, void *data) {
struct wlr_pointer_button_event *event = data;
struct wlr_keyboard *hard_keyboard, *keyboard;
unsigned int hard_mods, mods;
uint32_t hard_mods, mods;
Client *c = NULL;
LayerSurface *l = NULL;
struct wlr_surface *surface;
@@ -2006,6 +2034,7 @@ void setcursorshape(struct wl_listener *listener, void *data) {
}
void cleanuplisteners(void) {
wl_list_remove(&print_status_listener.link);
wl_list_remove(&cursor_axis.link);
wl_list_remove(&cursor_button.link);
wl_list_remove(&cursor_frame.link);
@@ -2076,7 +2105,7 @@ void cleanup(void) {
void cleanupmon(struct wl_listener *listener, void *data) {
Monitor *m = wl_container_of(listener, m, destroy);
LayerSurface *l = NULL, *tmp = NULL;
unsigned int i;
uint32_t i;
/* m->layers[i] are intentionally not unlinked */
for (i = 0; i < LENGTH(m->layers); i++) {
@@ -2490,14 +2519,14 @@ KeyboardGroup *createkeyboardgroup(void) {
xkb_mod_index_t mod_index =
xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM);
if (mod_index != XKB_MOD_INVALID)
locked_mods |= (unsigned int)1 << mod_index;
locked_mods |= (uint32_t)1 << mod_index;
}
if (capslock) {
xkb_mod_index_t mod_index =
xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS);
if (mod_index != XKB_MOD_INVALID)
locked_mods |= (unsigned int)1 << mod_index;
locked_mods |= (uint32_t)1 << mod_index;
}
if (locked_mods)
@@ -2621,7 +2650,7 @@ void createmon(struct wl_listener *listener, void *data) {
* monitor) becomes available. */
struct wlr_output *wlr_output = data;
const ConfigMonitorRule *r;
unsigned int i;
uint32_t i;
int ji, jk;
struct wlr_output_state state;
Monitor *m = NULL;
@@ -3141,6 +3170,7 @@ void destroykeyboardgroup(struct wl_listener *listener, void *data) {
void focusclient(Client *c, int lift) {
Client *last_focus_client = NULL;
Monitor *um = NULL;
struct wlr_surface *old_keyboard_focus_surface =
seat->keyboard_state.focused_surface;
@@ -3180,9 +3210,11 @@ void focusclient(Client *c, int lift) {
selmon = c->mon;
selmon->prevsel = selmon->sel;
selmon->sel = c;
c->isfocusing = true;
if (last_focus_client && !last_focus_client->iskilling &&
last_focus_client != c) {
last_focus_client->isfocusing = false;
client_set_unfocused_opacity_animation(last_focus_client);
}
@@ -3205,6 +3237,15 @@ void focusclient(Client *c, int lift) {
c->isurgent = 0;
}
// update other monitor focus disappear
wl_list_for_each(um, &mons, link) {
if (um->wlr_output->enabled && um != selmon && um->sel &&
!um->sel->iskilling && um->sel->isfocusing) {
um->sel->isfocusing = false;
client_set_unfocused_opacity_animation(um->sel);
}
}
if (c && !c->iskilling && c->foreign_toplevel)
wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, true);
@@ -3283,7 +3324,7 @@ void inputdevice(struct wl_listener *listener, void *data) {
/* This event is raised by the backend when a new input device becomes
* available. */
struct wlr_input_device *device = data;
unsigned int caps;
uint32_t caps;
switch (device->type) {
case WLR_INPUT_DEVICE_KEYBOARD:
@@ -3340,8 +3381,8 @@ bool is_keyboard_shortcut_inhibitor(struct wlr_surface *surface) {
}
int // 17
keybinding(unsigned int state, bool locked, unsigned int mods, xkb_keysym_t sym,
unsigned int keycode) {
keybinding(uint32_t state, bool locked, uint32_t mods, xkb_keysym_t sym,
uint32_t keycode) {
/*
* Here we handle compositor keybindings. This is when the compositor is
* processing keys, rather than passing them on to the client for its
@@ -3405,10 +3446,10 @@ keybinding(unsigned int state, bool locked, unsigned int mods, xkb_keysym_t sym,
bool keypressglobal(struct wlr_surface *last_surface,
struct wlr_keyboard *keyboard,
struct wlr_keyboard_key_event *event, unsigned int mods,
xkb_keysym_t keysym, unsigned int keycode) {
struct wlr_keyboard_key_event *event, uint32_t mods,
xkb_keysym_t keysym, uint32_t keycode) {
Client *c = NULL, *lastc = focustop(selmon);
unsigned int keycodes[32] = {0};
uint32_t keycodes[32] = {0};
int reset = false;
const char *appid = NULL;
const char *title = NULL;
@@ -3484,19 +3525,19 @@ void keypress(struct wl_listener *listener, void *data) {
#endif
/* Translate libinput keycode -> xkbcommon */
unsigned int keycode = event->keycode + 8;
uint32_t keycode = event->keycode + 8;
/* Get a list of keysyms based on the keymap for this keyboard */
const xkb_keysym_t *syms;
int nsyms = xkb_state_key_get_syms(group->wlr_group->keyboard.xkb_state,
keycode, &syms);
int handled = 0;
unsigned int mods = wlr_keyboard_get_modifiers(&group->wlr_group->keyboard);
uint32_t mods = wlr_keyboard_get_modifiers(&group->wlr_group->keyboard);
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
// ov tab mode detect moe key release
if (ov_tab_mode && !locked &&
if (ov_tab_mode && !locked && group == kb_group &&
event->state == WL_KEYBOARD_KEY_STATE_RELEASED &&
(keycode == 133 || keycode == 37 || keycode == 64 || keycode == 50 ||
keycode == 134 || keycode == 105 || keycode == 108 || keycode == 62) &&
@@ -3630,6 +3671,7 @@ static void iter_xdg_scene_buffers(struct wlr_scene_buffer *buffer, int sx,
}
void init_client_properties(Client *c) {
c->isfocusing = false;
c->ismaximizescreen = 0;
c->isfullscreen = 0;
c->need_float_size_reduce = 0;
@@ -3893,7 +3935,7 @@ void motionabsolute(struct wl_listener *listener, void *data) {
motionnotify(event->time_msec, &event->pointer->base, dx, dy, dx, dy);
}
void motionnotify(unsigned int time, struct wlr_input_device *device, double dx,
void motionnotify(uint32_t time, struct wlr_input_device *device, double dx,
double dy, double dx_unaccel, double dy_unaccel) {
double sx = 0, sy = 0, sx_confined, sy_confined;
Client *c = NULL, *w = NULL;
@@ -3988,35 +4030,18 @@ void motionnotify(unsigned int time, struct wlr_input_device *device, double dx,
if (!surface && !seat->drag && !cursor_hidden)
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
if (c && c->mon && !c->animation.running &&
(!(c->geom.x + c->geom.width > c->mon->m.x + c->mon->m.width ||
c->geom.x < c->mon->m.x ||
c->geom.y + c->geom.height > c->mon->m.y + c->mon->m.height ||
c->geom.y < c->mon->m.y) ||
!ISTILED(c))) {
if (c && c->mon && !c->animation.running && (INSIDEMON(c) || !ISTILED(c))) {
scroller_focus_lock = 0;
}
should_lock = false;
if (!scroller_focus_lock ||
!(c && c->mon &&
(c->geom.x + c->geom.width > c->mon->m.x + c->mon->m.width ||
c->geom.x < c->mon->m.x ||
c->geom.y + c->geom.height > c->mon->m.y + c->mon->m.height ||
c->geom.y < c->mon->m.y))) {
if (c && c->mon && is_scroller_layout(c->mon) &&
(c->geom.x + c->geom.width > c->mon->m.x + c->mon->m.width ||
c->geom.x < c->mon->m.x ||
c->geom.y + c->geom.height > c->mon->m.y + c->mon->m.height ||
c->geom.y < c->mon->m.y)) {
if (!scroller_focus_lock || !(c && c->mon && !INSIDEMON(c))) {
if (c && c->mon && is_scroller_layout(c->mon) && !INSIDEMON(c)) {
should_lock = true;
}
if (!(!edge_scroller_pointer_focus && c && c->mon &&
is_scroller_layout(c->mon) &&
(c->geom.x < c->mon->m.x || c->geom.y < c->mon->m.y ||
c->geom.x + c->geom.width > c->mon->m.x + c->mon->m.width ||
c->geom.y + c->geom.height > c->mon->m.y + c->mon->m.height)))
is_scroller_layout(c->mon) && !INSIDEMON(c)))
pointerfocus(c, surface, sx, sy, time);
if (should_lock && c && c->mon && ISTILED(c) && c == c->mon->sel) {
@@ -4118,7 +4143,7 @@ void outputmgrtest(struct wl_listener *listener, void *data) {
}
void pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
unsigned int time) {
uint32_t time) {
struct timespec now;
if (surface != seat->pointer_state.focused_surface && sloppyfocus && time &&
@@ -4143,20 +4168,8 @@ void pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy,
wlr_seat_pointer_notify_motion(seat, time, sx, sy);
}
void // 17
printstatus(void) {
Monitor *m = NULL;
wl_list_for_each(m, &mons, link) {
if (!m->wlr_output->enabled) {
continue;
}
// Update workspace active states
dwl_ext_workspace_printstatus(m);
// Update IPC output status
dwl_ipc_output_printstatus(m);
}
}
// 修改printstatus函数接受掩码参数
void printstatus(void) { wl_signal_emit(&mango_print_status, NULL); }
void powermgrsetmode(struct wl_listener *listener, void *data) {
struct wlr_output_power_v1_set_mode_event *event = data;
@@ -4297,7 +4310,7 @@ void setborder_color(Client *c) {
void exchange_two_client(Client *c1, Client *c2) {
Monitor *tmp_mon = NULL;
unsigned int tmp_tags;
uint32_t tmp_tags;
double master_inner_per = 0.0f;
double master_mfact_per = 0.0f;
double stack_innder_per = 0.0f;
@@ -4375,7 +4388,6 @@ run(char *startup_cmd) {
set_env();
char autostart_temp_path[1024];
/* Add a Unix socket to the Wayland display. */
const char *socket = wl_display_add_socket_auto(dpy);
if (!socket)
@@ -4389,9 +4401,7 @@ run(char *startup_cmd) {
/* Now that the socket exists and the backend is started, run the
* startup command */
if (!startup_cmd)
startup_cmd = get_autostart_path(autostart_temp_path,
sizeof(autostart_temp_path));
if (startup_cmd) {
int piperw[2];
if (pipe(piperw) < 0)
@@ -4734,9 +4744,9 @@ void reset_keyboard_layout(void) {
}
// Apply the new keymap
unsigned int depressed = keyboard->modifiers.depressed;
unsigned int latched = keyboard->modifiers.latched;
unsigned int locked = keyboard->modifiers.locked;
uint32_t depressed = keyboard->modifiers.depressed;
uint32_t latched = keyboard->modifiers.latched;
uint32_t locked = keyboard->modifiers.locked;
wlr_keyboard_set_keymap(keyboard, new_keymap);
@@ -4771,7 +4781,7 @@ cleanup_context:
xkb_context_unref(context);
}
void setmon(Client *c, Monitor *m, unsigned int newtags, bool focus) {
void setmon(Client *c, Monitor *m, uint32_t newtags, bool focus) {
Monitor *oldmon = c->mon;
if (oldmon == m)
@@ -4841,7 +4851,7 @@ void setsel(struct wl_listener *listener, void *data) {
}
void show_hide_client(Client *c) {
unsigned int target = 1;
uint32_t target = 1;
set_size_per(c->mon, c);
target = get_tags_first_tag(c->oldtags);
@@ -4879,6 +4889,20 @@ void create_output(struct wlr_backend *backend, void *data) {
#endif
}
// 修改信号处理函数,接收掩码参数
void handle_print_status(struct wl_listener *listener, void *data) {
Monitor *m = NULL;
wl_list_for_each(m, &mons, link) {
if (!m->wlr_output->enabled) {
continue;
}
dwl_ext_workspace_printstatus(m);
dwl_ipc_output_printstatus(m);
}
}
void setup(void) {
setenv("XCURSOR_SIZE", "24", 1);
@@ -4974,6 +4998,10 @@ void setup(void) {
wlr_alpha_modifier_v1_create(dpy);
wlr_ext_data_control_manager_v1_create(dpy, 1);
// 在 setup 函数中
wl_signal_init(&mango_print_status);
wl_signal_add(&mango_print_status, &print_status_listener);
/* Initializes the interface used to implement urgency hints */
activation = wlr_xdg_activation_v1_create(dpy);
wl_signal_add(&activation->events.request_activate, &request_activate);
@@ -5214,7 +5242,7 @@ void tag_client(const Arg *arg, Client *target_client) {
void overview(Monitor *m) { grid(m); }
// 目标窗口有其他窗口和它同个tag就返回0
unsigned int want_restore_fullscreen(Client *target_client) {
uint32_t want_restore_fullscreen(Client *target_client) {
Client *c = NULL;
wl_list_for_each(c, &clients, link) {
if (c && c != target_client && c->tags == target_client->tags &&
@@ -5590,7 +5618,7 @@ urgent(struct wl_listener *listener, void *data) {
void view_in_mon(const Arg *arg, bool want_animation, Monitor *m,
bool changefocus) {
unsigned int i, tmptag;
uint32_t i, tmptag;
if (!m || (arg->ui != (~0 & TAGMASK) && m->isoverview)) {
return;
@@ -5601,9 +5629,9 @@ void view_in_mon(const Arg *arg, bool want_animation, Monitor *m,
}
if (arg->ui == UINT32_MAX) {
m->pertag->prevtag = m->tagset[m->seltags];
m->pertag->prevtag = get_tags_first_tag_num(m->tagset[m->seltags]);
m->seltags ^= 1; /* toggle sel tagset */
m->pertag->curtag = m->tagset[m->seltags];
m->pertag->curtag = get_tags_first_tag_num(m->tagset[m->seltags]);
goto toggleseltags;
}
@@ -5888,13 +5916,15 @@ int main(int argc, char *argv[]) {
char *startup_cmd = NULL;
int c;
while ((c = getopt(argc, argv, "s:hdv")) != -1) {
while ((c = getopt(argc, argv, "s:c:hdv")) != -1) {
if (c == 's')
startup_cmd = optarg;
else if (c == 'd')
log_level = WLR_DEBUG;
else if (c == 'v')
die("mango " VERSION);
else if (c == 'c')
cli_config_path = optarg;
else
goto usage;
}
@@ -5912,5 +5942,5 @@ int main(int argc, char *argv[]) {
return EXIT_SUCCESS;
usage:
die("Usage: %s [-v] [-d] [-s startup command]", argv[0]);
die("Usage: %s [-v] [-d] [-c config file] [-s startup command]", argv[0]);
}