mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-06-19 14:33:16 -04:00
feat: add overview jump mode
This commit is contained in:
parent
24fb167ae6
commit
a515ad9b91
13 changed files with 576 additions and 1 deletions
36
src/mango.c
36
src/mango.c
|
|
@ -96,6 +96,7 @@
|
|||
#include <xcb/xcb_icccm.h>
|
||||
#endif
|
||||
#include "common/util.h"
|
||||
#include "draw/text-node.h"
|
||||
|
||||
/* macros */
|
||||
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
||||
|
|
@ -327,6 +328,7 @@ struct Client {
|
|||
struct wlr_scene_shadow *shadow;
|
||||
struct wlr_scene_tree *scene_surface;
|
||||
struct wlr_scene_tree *overview_scene_surface;
|
||||
struct mango_text_node *text_node;
|
||||
struct wl_list link;
|
||||
struct wl_list flink;
|
||||
struct wl_list fadeout_link;
|
||||
|
|
@ -433,6 +435,7 @@ struct Client {
|
|||
int32_t allow_shortcuts_inhibit;
|
||||
float scroller_proportion_single;
|
||||
bool isfocusing;
|
||||
char jump_char;
|
||||
bool enable_drop_area_draw;
|
||||
int32_t drop_direction;
|
||||
struct wlr_box drag_tile_float_backup_geom;
|
||||
|
|
@ -554,6 +557,7 @@ struct Monitor {
|
|||
uint32_t ovbk_prev_tagset;
|
||||
Client *sel, *prevsel;
|
||||
int32_t isoverview;
|
||||
int32_t is_jump_mode;
|
||||
int32_t is_in_hotarea;
|
||||
int32_t asleep;
|
||||
uint32_t visible_clients;
|
||||
|
|
@ -899,6 +903,10 @@ Client *scroll_get_stack_tail_client(Client *c);
|
|||
static DwindleNode *dwindle_find_leaf(DwindleNode *node, Client *c);
|
||||
static void overview_backup_surface(Client *c);
|
||||
|
||||
static void create_jump_hints(Monitor *m);
|
||||
static void finish_jump_mode(Monitor *m);
|
||||
static void begin_jump_mode(Monitor *m);
|
||||
|
||||
#include "data/static_keymap.h"
|
||||
#include "dispatch/bind_declare.h"
|
||||
#include "layout/layout.h"
|
||||
|
|
@ -2561,6 +2569,8 @@ void cleanup(void) {
|
|||
/* Destroy after the wayland display (when the monitors are already
|
||||
destroyed) to avoid destroying them with an invalid scene output. */
|
||||
wlr_scene_node_destroy(&scene->tree.node);
|
||||
|
||||
mango_text_global_finish();
|
||||
}
|
||||
|
||||
void cleanupmon(struct wl_listener *listener, void *data) {
|
||||
|
|
@ -4254,6 +4264,27 @@ void keypress(struct wl_listener *listener, void *data) {
|
|||
if (handled)
|
||||
return;
|
||||
|
||||
if (selmon && selmon->is_jump_mode &&
|
||||
event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
for (i = 0; i < nsyms; i++) {
|
||||
xkb_keysym_t sym = xkb_keysym_to_lower(syms[i]);
|
||||
if (sym >= XKB_KEY_a && sym <= XKB_KEY_z) {
|
||||
char c_char = 'A' + (sym - XKB_KEY_a);
|
||||
Client *c;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->mon == selmon && c->jump_char == c_char) {
|
||||
focusclient(c, 1);
|
||||
toggleoverview(&(Arg){.i = 1});
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (sym == XKB_KEY_Escape) {
|
||||
togglejump(&(Arg){.i = 0});
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* don't pass when popup is focused
|
||||
* this is better than having popups (like fuzzel or wmenu) closing
|
||||
* while typing in a passed keybind */
|
||||
|
|
@ -4513,6 +4544,10 @@ mapnotify(struct wl_listener *listener, void *data) {
|
|||
#endif
|
||||
// extra node
|
||||
|
||||
c->text_node = mango_text_node_create(c->scene, config.jumhitdata);
|
||||
wlr_scene_node_lower_to_bottom(&c->text_node->scene_buffer->node);
|
||||
wlr_scene_node_set_enabled(&c->text_node->scene_buffer->node, false);
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
c->splitindicator[i] = wlr_scene_rect_create(
|
||||
c->scene, 0, 0,
|
||||
|
|
@ -6510,6 +6545,7 @@ void unmapnotify(struct wl_listener *listener, void *data) {
|
|||
|
||||
c->stack_proportion = 0.0f;
|
||||
|
||||
mango_text_node_destroy(c->text_node);
|
||||
wlr_scene_node_destroy(&c->scene->node);
|
||||
printstatus(IPC_WATCH_ARRANGGE);
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue