mirror of
				https://codeberg.org/dwl/dwl.git
				synced 2025-10-31 03:54:15 +00:00 
			
		
		
		
	Merge branch 'main' into wlroots-next
This commit is contained in:
		
						commit
						a66210ebbc
					
				| @ -19,15 +19,14 @@ dwl is not meant to provide every feature under the sun. Instead, like dwm, it s | |||||||
| - Various Wayland protocols | - Various Wayland protocols | ||||||
| - XWayland support as provided by wlroots (can be enabled in `config.mk`) | - XWayland support as provided by wlroots (can be enabled in `config.mk`) | ||||||
| - Zero flickering - Wayland users naturally expect that "every frame is perfect" | - Zero flickering - Wayland users naturally expect that "every frame is perfect" | ||||||
|  | - Layer shell popups (used by Waybar) | ||||||
|  | - Damage tracking provided by scenegraph API | ||||||
| 
 | 
 | ||||||
| Features under consideration (possibly as patches) are: | Features under consideration (possibly as patches) are: | ||||||
| 
 | 
 | ||||||
| - Protocols made trivial by wlroots | - Protocols made trivial by wlroots | ||||||
| - Implement the input-inhibitor protocol to support screen lockers | - Implement the input-inhibitor protocol to support screen lockers (see https://github.com/djpohly/dwl/pull/132) | ||||||
| - Implement the idle-inhibit protocol which lets applications such as mpv disable idle monitoring | - Implement the idle-inhibit protocol which lets applications such as mpv disable idle monitoring (see https://github.com/djpohly/dwl/pull/133) | ||||||
| - Layer shell popups (used by Waybar) |  | ||||||
| - Basic yes/no damage tracking to avoid needless redraws |  | ||||||
| - More in-depth damage region tracking ([which may improve power usage](https://mozillagfx.wordpress.com/2019/10/22/dramatically-reduced-power-usage-in-firefox-70-on-macos-with-core-animation/)) |  | ||||||
| - Implement the text-input and input-method protocols to support IME once ibus implements input-method v2 (see https://github.com/ibus/ibus/pull/2256 and https://github.com/djpohly/dwl/pull/12) | - Implement the text-input and input-method protocols to support IME once ibus implements input-method v2 (see https://github.com/ibus/ibus/pull/2256 and https://github.com/djpohly/dwl/pull/12) | ||||||
| 
 | 
 | ||||||
| Feature *non-goals* for the main codebase include: | Feature *non-goals* for the main codebase include: | ||||||
|  | |||||||
							
								
								
									
										51
									
								
								client.h
									
									
									
									
									
								
							
							
						
						
									
										51
									
								
								client.h
									
									
									
									
									
								
							| @ -103,6 +103,16 @@ client_is_float_type(Client *c) | |||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | static inline int | ||||||
|  | client_wants_fullscreen(Client *c) | ||||||
|  | { | ||||||
|  | #ifdef XWAYLAND | ||||||
|  | 	if (client_is_x11(c)) | ||||||
|  | 		return c->surface.xwayland->fullscreen; | ||||||
|  | #endif | ||||||
|  | 	return c->surface.xdg->toplevel->requested.fullscreen; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| static inline int | static inline int | ||||||
| client_is_unmanaged(Client *c) | client_is_unmanaged(Client *c) | ||||||
| { | { | ||||||
| @ -169,3 +179,44 @@ client_surface_at(Client *c, double cx, double cy, double *sx, double *sy) | |||||||
| #endif | #endif | ||||||
| 	return wlr_xdg_surface_surface_at(c->surface.xdg, cx, cy, sx, sy); | 	return wlr_xdg_surface_surface_at(c->surface.xdg, cx, cy, sx, sy); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | static inline void | ||||||
|  | client_min_size(Client *c, int *width, int *height) | ||||||
|  | { | ||||||
|  | 	struct wlr_xdg_toplevel *toplevel; | ||||||
|  | 	struct wlr_xdg_toplevel_state *state; | ||||||
|  | #ifdef XWAYLAND | ||||||
|  | 	if (client_is_x11(c)) { | ||||||
|  | 		struct wlr_xwayland_surface_size_hints *size_hints; | ||||||
|  | 		size_hints = c->surface.xwayland->size_hints; | ||||||
|  | 		*width = size_hints->min_width; | ||||||
|  | 		*height = size_hints->min_height; | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | #endif | ||||||
|  | 	toplevel = c->surface.xdg->toplevel; | ||||||
|  | 	state = &toplevel->current; | ||||||
|  | 	*width = state->min_width; | ||||||
|  | 	*height = state->min_height; | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | static inline Client * | ||||||
|  | client_from_popup(struct wlr_xdg_popup *popup) | ||||||
|  | { | ||||||
|  | 	struct wlr_xdg_surface *surface = popup->base; | ||||||
|  | 
 | ||||||
|  | 	while (1) { | ||||||
|  | 		switch (surface->role) { | ||||||
|  | 		case WLR_XDG_SURFACE_ROLE_POPUP: | ||||||
|  | 			if (!wlr_surface_is_xdg_surface(surface->popup->parent)) | ||||||
|  | 				return NULL; | ||||||
|  | 
 | ||||||
|  | 			surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent); | ||||||
|  | 			break; | ||||||
|  | 		case WLR_XDG_SURFACE_ROLE_TOPLEVEL: | ||||||
|  | 				return surface->data; | ||||||
|  | 		case WLR_XDG_SURFACE_ROLE_NONE: | ||||||
|  | 			return NULL; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | |||||||
| @ -84,7 +84,7 @@ static const Key keys[] = { | |||||||
| 	{ MODKEY,                    XKB_KEY_m,          setlayout,      {.v = &layouts[2]} }, | 	{ MODKEY,                    XKB_KEY_m,          setlayout,      {.v = &layouts[2]} }, | ||||||
| 	{ MODKEY,                    XKB_KEY_space,      setlayout,      {0} }, | 	{ MODKEY,                    XKB_KEY_space,      setlayout,      {0} }, | ||||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space,      togglefloating, {0} }, | 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space,      togglefloating, {0} }, | ||||||
| 	{ MODKEY, 					 XKB_KEY_e,    		togglefullscreen, {0} }, | 	{ MODKEY,                    XKB_KEY_e,         togglefullscreen, {0} }, | ||||||
| 	{ MODKEY,                    XKB_KEY_0,          view,           {.ui = ~0} }, | 	{ MODKEY,                    XKB_KEY_0,          view,           {.ui = ~0} }, | ||||||
| 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag,            {.ui = ~0} }, | 	{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag,            {.ui = ~0} }, | ||||||
| 	{ MODKEY,                    XKB_KEY_comma,      focusmon,       {.i = WLR_DIRECTION_LEFT} }, | 	{ MODKEY,                    XKB_KEY_comma,      focusmon,       {.i = WLR_DIRECTION_LEFT} }, | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ | |||||||
| PREFIX = /usr/local | PREFIX = /usr/local | ||||||
| 
 | 
 | ||||||
| # Default compile flags (overridable by environment)
 | # Default compile flags (overridable by environment)
 | ||||||
| CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wdeclaration-after-statement | CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-result -Wdeclaration-after-statement | ||||||
| 
 | 
 | ||||||
| # Uncomment to build XWayland support
 | # Uncomment to build XWayland support
 | ||||||
| #CFLAGS += -DXWAYLAND
 | #CFLAGS += -DXWAYLAND
 | ||||||
|  | |||||||
							
								
								
									
										258
									
								
								dwl.c
									
									
									
									
									
								
							
							
						
						
									
										258
									
								
								dwl.c
									
									
									
									
									
								
							| @ -59,7 +59,7 @@ | |||||||
| #define MAX(A, B)               ((A) > (B) ? (A) : (B)) | #define MAX(A, B)               ((A) > (B) ? (A) : (B)) | ||||||
| #define MIN(A, B)               ((A) < (B) ? (A) : (B)) | #define MIN(A, B)               ((A) < (B) ? (A) : (B)) | ||||||
| #define CLEANMASK(mask)         (mask & ~WLR_MODIFIER_CAPS) | #define CLEANMASK(mask)         (mask & ~WLR_MODIFIER_CAPS) | ||||||
| #define VISIBLEON(C, M)         ((C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) | #define VISIBLEON(C, M)         ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags])) | ||||||
| #define LENGTH(X)               (sizeof X / sizeof X[0]) | #define LENGTH(X)               (sizeof X / sizeof X[0]) | ||||||
| #define END(A)                  ((A) + LENGTH(A)) | #define END(A)                  ((A) + LENGTH(A)) | ||||||
| #define TAGMASK                 ((1 << LENGTH(tags)) - 1) | #define TAGMASK                 ((1 << LENGTH(tags)) - 1) | ||||||
| @ -107,7 +107,7 @@ typedef struct { | |||||||
| 	struct wl_listener destroy; | 	struct wl_listener destroy; | ||||||
| 	struct wl_listener set_title; | 	struct wl_listener set_title; | ||||||
| 	struct wl_listener fullscreen; | 	struct wl_listener fullscreen; | ||||||
| 	struct wlr_box geom;  /* layout-relative, includes border */ | 	struct wlr_box geom, prev;  /* layout-relative, includes border */ | ||||||
| 	Monitor *mon; | 	Monitor *mon; | ||||||
| #ifdef XWAYLAND | #ifdef XWAYLAND | ||||||
| 	struct wl_listener activate; | 	struct wl_listener activate; | ||||||
| @ -117,10 +117,6 @@ typedef struct { | |||||||
| 	unsigned int tags; | 	unsigned int tags; | ||||||
| 	int isfloating, isurgent; | 	int isfloating, isurgent; | ||||||
| 	uint32_t resize; /* configure serial of a pending resize */ | 	uint32_t resize; /* configure serial of a pending resize */ | ||||||
| 	int prevx; |  | ||||||
| 	int prevy; |  | ||||||
| 	int prevwidth; |  | ||||||
| 	int prevheight; |  | ||||||
| 	int isfullscreen; | 	int isfullscreen; | ||||||
| } Client; | } Client; | ||||||
| 
 | 
 | ||||||
| @ -167,7 +163,7 @@ struct Monitor { | |||||||
| 	struct wl_listener destroy; | 	struct wl_listener destroy; | ||||||
| 	struct wlr_box m;      /* monitor area, layout-relative */ | 	struct wlr_box m;      /* monitor area, layout-relative */ | ||||||
| 	struct wlr_box w;      /* window area, layout-relative */ | 	struct wlr_box w;      /* window area, layout-relative */ | ||||||
| 	struct wl_list layers[4]; // LayerSurface::link
 | 	struct wl_list layers[4]; /* LayerSurface::link */ | ||||||
| 	const Layout *lt[2]; | 	const Layout *lt[2]; | ||||||
| 	unsigned int seltags; | 	unsigned int seltags; | ||||||
| 	unsigned int sellt; | 	unsigned int sellt; | ||||||
| @ -295,7 +291,6 @@ static struct wlr_xdg_shell *xdg_shell; | |||||||
| static struct wlr_xdg_activation_v1 *activation; | static struct wlr_xdg_activation_v1 *activation; | ||||||
| static struct wl_list clients; /* tiling order */ | static struct wl_list clients; /* tiling order */ | ||||||
| static struct wl_list fstack;  /* focus order */ | static struct wl_list fstack;  /* focus order */ | ||||||
| static struct wl_list independents; |  | ||||||
| static struct wlr_idle *idle; | static struct wlr_idle *idle; | ||||||
| static struct wlr_layer_shell_v1 *layer_shell; | static struct wlr_layer_shell_v1 *layer_shell; | ||||||
| static struct wlr_output_manager_v1 *output_mgr; | static struct wlr_output_manager_v1 *output_mgr; | ||||||
| @ -436,6 +431,7 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int | |||||||
| void | void | ||||||
| arrangelayers(Monitor *m) | arrangelayers(Monitor *m) | ||||||
| { | { | ||||||
|  | 	int i; | ||||||
| 	struct wlr_box usable_area = m->m; | 	struct wlr_box usable_area = m->m; | ||||||
| 	uint32_t layers_above_shell[] = { | 	uint32_t layers_above_shell[] = { | ||||||
| 		ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, | 		ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, | ||||||
| @ -444,38 +440,26 @@ arrangelayers(Monitor *m) | |||||||
| 	LayerSurface *layersurface; | 	LayerSurface *layersurface; | ||||||
| 	struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat); | 	struct wlr_keyboard *kb = wlr_seat_get_keyboard(seat); | ||||||
| 
 | 
 | ||||||
| 	// Arrange exclusive surfaces from top->bottom
 | 	/* Arrange exclusive surfaces from top->bottom */ | ||||||
| 	arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], | 	for (i = 3; i >= 0; i--) | ||||||
| 			&usable_area, 1); | 		arrangelayer(m, &m->layers[i], &usable_area, 1); | ||||||
| 	arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], |  | ||||||
| 			&usable_area, 1); |  | ||||||
| 	arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], |  | ||||||
| 			&usable_area, 1); |  | ||||||
| 	arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], |  | ||||||
| 			&usable_area, 1); |  | ||||||
| 
 | 
 | ||||||
| 	if (memcmp(&usable_area, &m->w, sizeof(struct wlr_box))) { | 	if (memcmp(&usable_area, &m->w, sizeof(struct wlr_box))) { | ||||||
| 		m->w = usable_area; | 		m->w = usable_area; | ||||||
| 		arrange(m); | 		arrange(m); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Arrange non-exlusive surfaces from top->bottom
 | 	/* Arrange non-exlusive surfaces from top->bottom */ | ||||||
| 	arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], | 	for (i = 3; i >= 0; i--) | ||||||
| 			&usable_area, 0); | 		arrangelayer(m, &m->layers[i], &usable_area, 0); | ||||||
| 	arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_TOP], |  | ||||||
| 			&usable_area, 0); |  | ||||||
| 	arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], |  | ||||||
| 			&usable_area, 0); |  | ||||||
| 	arrangelayer(m, &m->layers[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], |  | ||||||
| 			&usable_area, 0); |  | ||||||
| 
 | 
 | ||||||
| 	// Find topmost keyboard interactive layer, if such a layer exists
 | 	/* Find topmost keyboard interactive layer, if such a layer exists */ | ||||||
| 	for (size_t i = 0; i < LENGTH(layers_above_shell); i++) { | 	for (size_t i = 0; i < LENGTH(layers_above_shell); i++) { | ||||||
| 		wl_list_for_each_reverse(layersurface, | 		wl_list_for_each_reverse(layersurface, | ||||||
| 				&m->layers[layers_above_shell[i]], link) { | 				&m->layers[layers_above_shell[i]], link) { | ||||||
| 			if (layersurface->layer_surface->current.keyboard_interactive && | 			if (layersurface->layer_surface->current.keyboard_interactive && | ||||||
| 					layersurface->layer_surface->mapped) { | 					layersurface->layer_surface->mapped) { | ||||||
| 				// Deactivate the focused client.
 | 				/* Deactivate the focused client. */ | ||||||
| 				focusclient(NULL, 0); | 				focusclient(NULL, 0); | ||||||
| 				wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, | 				wlr_seat_keyboard_notify_enter(seat, layersurface->layer_surface->surface, | ||||||
| 						kb->keycodes, kb->num_keycodes, &kb->modifiers); | 						kb->keycodes, kb->num_keycodes, &kb->modifiers); | ||||||
| @ -510,10 +494,11 @@ buttonpress(struct wl_listener *listener, void *data) | |||||||
| 	wlr_idle_notify_activity(idle, seat); | 	wlr_idle_notify_activity(idle, seat); | ||||||
| 
 | 
 | ||||||
| 	switch (event->state) { | 	switch (event->state) { | ||||||
| 	case WLR_BUTTON_PRESSED:; | 	case WLR_BUTTON_PRESSED: | ||||||
| 		/* Change focus if the button was _pressed_ over a client */ | 		/* Change focus if the button was _pressed_ over a client */ | ||||||
| 		xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL); | 		xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL); | ||||||
| 		if (c) | 		/* Don't focus unmanaged clients */ | ||||||
|  | 		if (c && !client_is_unmanaged(c)) | ||||||
| 			focusclient(c, 1); | 			focusclient(c, 1); | ||||||
| 
 | 
 | ||||||
| 		keyboard = wlr_seat_get_keyboard(seat); | 		keyboard = wlr_seat_get_keyboard(seat); | ||||||
| @ -530,8 +515,7 @@ buttonpress(struct wl_listener *listener, void *data) | |||||||
| 		/* If you released any buttons, we exit interactive move/resize mode. */ | 		/* If you released any buttons, we exit interactive move/resize mode. */ | ||||||
| 		/* TODO should reset to the pointer focus's current setcursor */ | 		/* TODO should reset to the pointer focus's current setcursor */ | ||||||
| 		if (cursor_mode != CurNormal) { | 		if (cursor_mode != CurNormal) { | ||||||
| 			wlr_xcursor_manager_set_cursor_image(cursor_mgr, | 			wlr_xcursor_manager_set_cursor_image(cursor_mgr, "left_ptr", cursor); | ||||||
| 					"left_ptr", cursor); |  | ||||||
| 			cursor_mode = CurNormal; | 			cursor_mode = CurNormal; | ||||||
| 			/* Drop the window off on its new monitor */ | 			/* Drop the window off on its new monitor */ | ||||||
| 			selmon = xytomon(cursor->x, cursor->y); | 			selmon = xytomon(cursor->x, cursor->y); | ||||||
| @ -593,10 +577,11 @@ cleanupmon(struct wl_listener *listener, void *data) | |||||||
| 	wl_list_remove(&m->link); | 	wl_list_remove(&m->link); | ||||||
| 	wlr_output_layout_remove(output_layout, m->wlr_output); | 	wlr_output_layout_remove(output_layout, m->wlr_output); | ||||||
| 
 | 
 | ||||||
| 	nmons = wl_list_length(&mons); | 	if ((nmons = wl_list_length(&mons))) | ||||||
| 	do // don't switch to disabled mons
 | 		do /* don't switch to disabled mons */ | ||||||
| 		selmon = wl_container_of(mons.prev, selmon, link); | 			selmon = wl_container_of(mons.prev, selmon, link); | ||||||
| 	while (!selmon->wlr_output->enabled && i++ < nmons); | 		while (!selmon->wlr_output->enabled && i++ < nmons); | ||||||
|  | 
 | ||||||
| 	focusclient(focustop(selmon), 1); | 	focusclient(focustop(selmon), 1); | ||||||
| 	closemon(m); | 	closemon(m); | ||||||
| 	free(m); | 	free(m); | ||||||
| @ -605,7 +590,7 @@ cleanupmon(struct wl_listener *listener, void *data) | |||||||
| void | void | ||||||
| closemon(Monitor *m) | closemon(Monitor *m) | ||||||
| { | { | ||||||
| 	// move closed monitor's clients to the focused one
 | 	/* move closed monitor's clients to the focused one */ | ||||||
| 	Client *c; | 	Client *c; | ||||||
| 
 | 
 | ||||||
| 	wl_list_for_each(c, &clients, link) { | 	wl_list_for_each(c, &clients, link) { | ||||||
| @ -656,6 +641,8 @@ createkeyboard(struct wlr_input_device *device) | |||||||
| 	struct xkb_context *context; | 	struct xkb_context *context; | ||||||
| 	struct xkb_keymap *keymap; | 	struct xkb_keymap *keymap; | ||||||
| 	Keyboard *kb = device->data = calloc(1, sizeof(*kb)); | 	Keyboard *kb = device->data = calloc(1, sizeof(*kb)); | ||||||
|  | 	if (!kb) | ||||||
|  | 		EBARF("createkeyboard: calloc"); | ||||||
| 	kb->device = device; | 	kb->device = device; | ||||||
| 
 | 
 | ||||||
| 	/* Prepare an XKB keymap and assign it to the keyboard. */ | 	/* Prepare an XKB keymap and assign it to the keyboard. */ | ||||||
| @ -687,6 +674,8 @@ createmon(struct wl_listener *listener, void *data) | |||||||
| 	struct wlr_output *wlr_output = data; | 	struct wlr_output *wlr_output = data; | ||||||
| 	const MonitorRule *r; | 	const MonitorRule *r; | ||||||
| 	Monitor *m = wlr_output->data = calloc(1, sizeof(*m)); | 	Monitor *m = wlr_output->data = calloc(1, sizeof(*m)); | ||||||
|  | 	if (!m) | ||||||
|  | 		EBARF("createmon: calloc"); | ||||||
| 	m->wlr_output = wlr_output; | 	m->wlr_output = wlr_output; | ||||||
| 
 | 
 | ||||||
| 	wlr_output_init_render(wlr_output, alloc, drw); | 	wlr_output_init_render(wlr_output, alloc, drw); | ||||||
| @ -733,21 +722,47 @@ createmon(struct wl_listener *listener, void *data) | |||||||
| 	 */ | 	 */ | ||||||
| 	m->scene_output = wlr_scene_output_create(scene, wlr_output); | 	m->scene_output = wlr_scene_output_create(scene, wlr_output); | ||||||
| 	wlr_output_layout_add_auto(output_layout, wlr_output); | 	wlr_output_layout_add_auto(output_layout, wlr_output); | ||||||
|  | 
 | ||||||
|  | 	/* If length == 1 we need update selmon.
 | ||||||
|  | 	 * Maybe it will change in run(). */ | ||||||
|  | 	if (wl_list_length(&mons) == 1) { | ||||||
|  | 		Client *c; | ||||||
|  | 		selmon = m; | ||||||
|  | 		/* If there is any client, set c->mon to this monitor */ | ||||||
|  | 		wl_list_for_each(c, &clients, link) | ||||||
|  | 			setmon(c, m, c->tags); | ||||||
|  | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| createnotify(struct wl_listener *listener, void *data) | createnotify(struct wl_listener *listener, void *data) | ||||||
| { | { | ||||||
| 	/* This event is raised when wlr_xdg_shell receives a new xdg surface from a
 | 	/* This event is raised when wlr_xdg_shell receives a new xdg surface from a
 | ||||||
| 	 * client, either a toplevel (application window) or popup. */ | 	 * client, either a toplevel (application window) or popup, | ||||||
|  | 	 * or when wlr_layer_shell receives a new popup from a layer. | ||||||
|  | 	 * If you want to do something tricky with popups you should check if | ||||||
|  | 	 * its parent is wlr_xdg_shell or wlr_layer_shell */ | ||||||
| 	struct wlr_xdg_surface *xdg_surface = data; | 	struct wlr_xdg_surface *xdg_surface = data; | ||||||
| 	Client *c; | 	Client *c; | ||||||
| 
 | 
 | ||||||
| 	if (xdg_surface->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL) | 	if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) { | ||||||
|  | 		struct wlr_box box; | ||||||
|  | 		xdg_surface->surface->data = wlr_scene_xdg_surface_create( | ||||||
|  | 				xdg_surface->popup->parent->data, xdg_surface); | ||||||
|  | 		if (!(c = client_from_popup(xdg_surface->popup)) || !c->mon) | ||||||
|  | 			return; | ||||||
|  | 		box = c->mon->m; | ||||||
|  | 		box.x -= c->geom.x; | ||||||
|  | 		box.y -= c->geom.y; | ||||||
|  | 		wlr_xdg_popup_unconstrain_from_box(xdg_surface->popup, &box); | ||||||
|  | 		return; | ||||||
|  | 	} else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	/* Allocate a Client for this surface */ | 	/* Allocate a Client for this surface */ | ||||||
| 	c = xdg_surface->data = calloc(1, sizeof(*c)); | 	c = xdg_surface->data = calloc(1, sizeof(*c)); | ||||||
|  | 	if (!c) | ||||||
|  | 		EBARF("createnotify: calloc"); | ||||||
| 	c->surface.xdg = xdg_surface; | 	c->surface.xdg = xdg_surface; | ||||||
| 	c->bw = borderpx; | 	c->bw = borderpx; | ||||||
| 
 | 
 | ||||||
| @ -774,6 +789,8 @@ createlayersurface(struct wl_listener *listener, void *data) | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	layersurface = calloc(1, sizeof(LayerSurface)); | 	layersurface = calloc(1, sizeof(LayerSurface)); | ||||||
|  | 	if (!layersurface) | ||||||
|  | 		EBARF("layersurface: calloc"); | ||||||
| 	layersurface->type = LayerShell; | 	layersurface->type = LayerShell; | ||||||
| 	LISTEN(&wlr_layer_surface->surface->events.commit, | 	LISTEN(&wlr_layer_surface->surface->events.commit, | ||||||
| 		&layersurface->surface_commit, commitlayersurfacenotify); | 		&layersurface->surface_commit, commitlayersurfacenotify); | ||||||
| @ -790,14 +807,16 @@ createlayersurface(struct wl_listener *listener, void *data) | |||||||
| 
 | 
 | ||||||
| 	layersurface->scene_layer = wlr_scene_layer_surface_v1_create( | 	layersurface->scene_layer = wlr_scene_layer_surface_v1_create( | ||||||
| 			layers[wlr_layer_surface->pending.layer], wlr_layer_surface); | 			layers[wlr_layer_surface->pending.layer], wlr_layer_surface); | ||||||
| 	layersurface->scene = layersurface->scene_layer->node; | 	layersurface->scene = wlr_layer_surface->surface->data = | ||||||
|  | 			layersurface->scene_layer->node; | ||||||
| 	layersurface->scene->data = layersurface; | 	layersurface->scene->data = layersurface; | ||||||
| 
 | 
 | ||||||
| 	wl_list_insert(&m->layers[wlr_layer_surface->pending.layer], | 	wl_list_insert(&m->layers[wlr_layer_surface->pending.layer], | ||||||
| 			&layersurface->link); | 			&layersurface->link); | ||||||
| 
 | 
 | ||||||
| 	// Temporarily set the layer's current state to pending
 | 	/* Temporarily set the layer's current state to pending
 | ||||||
| 	// so that we can easily arrange it
 | 	 * so that we can easily arrange it | ||||||
|  | 	 */ | ||||||
| 	old_state = wlr_layer_surface->current; | 	old_state = wlr_layer_surface->current; | ||||||
| 	wlr_layer_surface->current = wlr_layer_surface->pending; | 	wlr_layer_surface->current = wlr_layer_surface->pending; | ||||||
| 	arrangelayers(m); | 	arrangelayers(m); | ||||||
| @ -868,9 +887,10 @@ destroynotify(struct wl_listener *listener, void *data) | |||||||
| 	wl_list_remove(&c->set_title.link); | 	wl_list_remove(&c->set_title.link); | ||||||
| 	wl_list_remove(&c->fullscreen.link); | 	wl_list_remove(&c->fullscreen.link); | ||||||
| #ifdef XWAYLAND | #ifdef XWAYLAND | ||||||
| 	if (c->type == X11Managed) | 	if (c->type != XDGShell) { | ||||||
|  | 		wl_list_remove(&c->configure.link); | ||||||
| 		wl_list_remove(&c->activate.link); | 		wl_list_remove(&c->activate.link); | ||||||
| 	else if (c->type == XDGShell) | 	} else | ||||||
| #endif | #endif | ||||||
| 		wl_list_remove(&c->commit.link); | 		wl_list_remove(&c->commit.link); | ||||||
| 	free(c); | 	free(c); | ||||||
| @ -892,24 +912,29 @@ setfullscreen(Client *c, int fullscreen) | |||||||
| 	client_set_fullscreen(c, fullscreen); | 	client_set_fullscreen(c, fullscreen); | ||||||
| 
 | 
 | ||||||
| 	if (fullscreen) { | 	if (fullscreen) { | ||||||
| 		c->prevx = c->geom.x; | 		c->prev = c->geom; | ||||||
| 		c->prevy = c->geom.y; |  | ||||||
| 		c->prevheight = c->geom.height; |  | ||||||
| 		c->prevwidth = c->geom.width; |  | ||||||
| 		resize(c, c->mon->m.x, c->mon->m.y, c->mon->m.width, c->mon->m.height, 0); | 		resize(c, c->mon->m.x, c->mon->m.y, c->mon->m.width, c->mon->m.height, 0); | ||||||
| 	} else { | 	} else { | ||||||
| 		/* restore previous size instead of arrange for floating windows since
 | 		/* restore previous size instead of arrange for floating windows since
 | ||||||
| 		 * client positions are set by the user and cannot be recalculated */ | 		 * client positions are set by the user and cannot be recalculated */ | ||||||
| 		resize(c, c->prevx, c->prevy, c->prevwidth, c->prevheight, 0); | 		resize(c, c->prev.x, c->prev.y, c->prev.width, c->prev.height, 0); | ||||||
| 		arrange(c->mon); |  | ||||||
| 	} | 	} | ||||||
|  | 	arrange(c->mon); | ||||||
|  | 	printstatus(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| fullscreennotify(struct wl_listener *listener, void *data) | fullscreennotify(struct wl_listener *listener, void *data) | ||||||
| { | { | ||||||
| 	Client *c = wl_container_of(listener, c, fullscreen); | 	Client *c = wl_container_of(listener, c, fullscreen); | ||||||
| 	setfullscreen(c, !c->isfullscreen); | 	int fullscreen = client_wants_fullscreen(c); | ||||||
|  | 
 | ||||||
|  | 	if (!c->mon) { | ||||||
|  | 		/* if the client is not mapped yet, let mapnotify() call setfullscreen() */ | ||||||
|  | 		c->isfullscreen = fullscreen; | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 	setfullscreen(c, fullscreen); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Monitor * | Monitor * | ||||||
| @ -931,7 +956,6 @@ focusclient(Client *c, int lift) | |||||||
| { | { | ||||||
| 	struct wlr_surface *old = seat->keyboard_state.focused_surface; | 	struct wlr_surface *old = seat->keyboard_state.focused_surface; | ||||||
| 	struct wlr_keyboard *kb; | 	struct wlr_keyboard *kb; | ||||||
| 	Client *w; |  | ||||||
| 	int i; | 	int i; | ||||||
| 
 | 
 | ||||||
| 	/* Raise client in stacking order if requested */ | 	/* Raise client in stacking order if requested */ | ||||||
| @ -969,15 +993,11 @@ focusclient(Client *c, int lift) | |||||||
| 						)) | 						)) | ||||||
| 				return; | 				return; | ||||||
| 		} else { | 		} else { | ||||||
| #ifdef XWAYLAND | 			Client *w; | ||||||
| 			if (wlr_surface_is_xwayland_surface(old)) | 			struct wlr_scene_node *node = old->data; | ||||||
| 				w = wlr_xwayland_surface_from_wlr_surface(old)->data; | 			if ((w = node->data)) | ||||||
| 			else | 				for (i = 0; i < 4; i++) | ||||||
| #endif | 					wlr_scene_rect_set_color(w->border[i], bordercolor); | ||||||
| 				w = wlr_xdg_surface_from_wlr_surface(old)->data; |  | ||||||
| 
 |  | ||||||
| 			for (i = 0; i < 4; i++) |  | ||||||
| 				wlr_scene_rect_set_color(w->border[i], bordercolor); |  | ||||||
| 
 | 
 | ||||||
| 			client_activate_surface(old, 0); | 			client_activate_surface(old, 0); | ||||||
| 		} | 		} | ||||||
| @ -1157,16 +1177,16 @@ void | |||||||
| killclient(const Arg *arg) | killclient(const Arg *arg) | ||||||
| { | { | ||||||
| 	Client *sel = selclient(); | 	Client *sel = selclient(); | ||||||
| 	if (!sel) | 	if (sel) | ||||||
| 		return; | 		client_send_close(sel); | ||||||
| 	client_send_close(sel); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| maplayersurfacenotify(struct wl_listener *listener, void *data) | maplayersurfacenotify(struct wl_listener *listener, void *data) | ||||||
| { | { | ||||||
| 	LayerSurface *layersurface = wl_container_of(listener, layersurface, map); | 	LayerSurface *layersurface = wl_container_of(listener, layersurface, map); | ||||||
| 	wlr_surface_send_enter(layersurface->layer_surface->surface, layersurface->layer_surface->output); | 	wlr_surface_send_enter(layersurface->layer_surface->surface, | ||||||
|  | 		layersurface->layer_surface->output); | ||||||
| 	motionnotify(0); | 	motionnotify(0); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -1179,22 +1199,25 @@ mapnotify(struct wl_listener *listener, void *data) | |||||||
| 
 | 
 | ||||||
| 	/* Create scene tree for this client and its border */ | 	/* Create scene tree for this client and its border */ | ||||||
| 	c->scene = &wlr_scene_tree_create(layers[LyrTile])->node; | 	c->scene = &wlr_scene_tree_create(layers[LyrTile])->node; | ||||||
| 	c->scene_surface = wlr_scene_subsurface_tree_create(c->scene, client_surface(c)); | 	c->scene_surface = client_surface(c)->data = c->type == XDGShell | ||||||
|  | 			? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg) | ||||||
|  | 			: wlr_scene_subsurface_tree_create(c->scene, client_surface(c)); | ||||||
| 	c->scene_surface->data = c; | 	c->scene_surface->data = c; | ||||||
|  | 
 | ||||||
|  | 	if (client_is_unmanaged(c)) { | ||||||
|  | 		client_get_geometry(c, &c->geom); | ||||||
|  | 		/* Floating */ | ||||||
|  | 		wlr_scene_node_reparent(c->scene, layers[LyrFloat]); | ||||||
|  | 		wlr_scene_node_set_position(c->scene, c->geom.x + borderpx, | ||||||
|  | 			c->geom.y + borderpx); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| 	for (i = 0; i < 4; i++) { | 	for (i = 0; i < 4; i++) { | ||||||
| 		c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, bordercolor); | 		c->border[i] = wlr_scene_rect_create(c->scene, 0, 0, bordercolor); | ||||||
| 		c->border[i]->node.data = c; | 		c->border[i]->node.data = c; | ||||||
| 		wlr_scene_rect_set_color(c->border[i], bordercolor); | 		wlr_scene_rect_set_color(c->border[i], bordercolor); | ||||||
| 	} | 		wlr_scene_node_lower_to_bottom(&c->border[i]->node); | ||||||
| 
 |  | ||||||
| 	if (client_is_unmanaged(c)) { |  | ||||||
| 		/* Floating, no border */ |  | ||||||
| 		wlr_scene_node_reparent(c->scene, layers[LyrFloat]); |  | ||||||
| 		c->bw = 0; |  | ||||||
| 
 |  | ||||||
| 		/* Insert this independent into independents lists. */ |  | ||||||
| 		wl_list_insert(&independents, &c->link); |  | ||||||
| 		return; |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* Initialize client geometry with room for border */ | 	/* Initialize client geometry with room for border */ | ||||||
| @ -1211,6 +1234,9 @@ mapnotify(struct wl_listener *listener, void *data) | |||||||
| 	applyrules(c); | 	applyrules(c); | ||||||
| 	resize(c, c->geom.x, c->geom.y, c->geom.width, c->geom.height, 0); | 	resize(c, c->geom.x, c->geom.y, c->geom.width, c->geom.height, 0); | ||||||
| 	printstatus(); | 	printstatus(); | ||||||
|  | 
 | ||||||
|  | 	if (c->isfullscreen) | ||||||
|  | 		setfullscreen(c, 1); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| @ -1246,7 +1272,7 @@ motionnotify(uint32_t time) | |||||||
| 	Client *c = NULL; | 	Client *c = NULL; | ||||||
| 	struct wlr_surface *surface = NULL; | 	struct wlr_surface *surface = NULL; | ||||||
| 
 | 
 | ||||||
| 	// time is 0 in internal calls meant to restore pointer focus.
 | 	/* time is 0 in internal calls meant to restore pointer focus. */ | ||||||
| 	if (time) { | 	if (time) { | ||||||
| 		wlr_idle_notify_activity(idle, seat); | 		wlr_idle_notify_activity(idle, seat); | ||||||
| 
 | 
 | ||||||
| @ -1275,8 +1301,7 @@ motionnotify(uint32_t time) | |||||||
| 	 * default. This is what makes the cursor image appear when you move it | 	 * default. This is what makes the cursor image appear when you move it | ||||||
| 	 * off of a client or over its border. */ | 	 * off of a client or over its border. */ | ||||||
| 	if (!surface && time) | 	if (!surface && time) | ||||||
| 		wlr_xcursor_manager_set_cursor_image(cursor_mgr, | 		wlr_xcursor_manager_set_cursor_image(cursor_mgr, "left_ptr", cursor); | ||||||
| 				"left_ptr", cursor); |  | ||||||
| 
 | 
 | ||||||
| 	pointerfocus(c, surface, sx, sy, time); | 	pointerfocus(c, surface, sx, sy, time); | ||||||
| } | } | ||||||
| @ -1302,7 +1327,7 @@ moveresize(const Arg *arg) | |||||||
| 	if (cursor_mode != CurNormal) | 	if (cursor_mode != CurNormal) | ||||||
| 		return; | 		return; | ||||||
| 	xytonode(cursor->x, cursor->y, NULL, &grabc, NULL, NULL, NULL); | 	xytonode(cursor->x, cursor->y, NULL, &grabc, NULL, NULL, NULL); | ||||||
| 	if (!grabc) | 	if (!grabc || client_is_unmanaged(grabc)) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
| 	/* Float the window and tell motionnotify to grab it */ | 	/* Float the window and tell motionnotify to grab it */ | ||||||
| @ -1393,9 +1418,8 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, | |||||||
| 	struct timespec now; | 	struct timespec now; | ||||||
| 	int internal_call = !time; | 	int internal_call = !time; | ||||||
| 
 | 
 | ||||||
| 	/* Use top level surface if nothing more specific given */ | 	if (sloppyfocus && !internal_call && c && !client_is_unmanaged(c)) | ||||||
| 	if (c && !surface) | 		focusclient(c, 0); | ||||||
| 		surface = client_surface(c); |  | ||||||
| 
 | 
 | ||||||
| 	/* If surface is NULL, clear pointer focus */ | 	/* If surface is NULL, clear pointer focus */ | ||||||
| 	if (!surface) { | 	if (!surface) { | ||||||
| @ -1408,21 +1432,12 @@ pointerfocus(Client *c, struct wlr_surface *surface, double sx, double sy, | |||||||
| 		time = now.tv_sec * 1000 + now.tv_nsec / 1000000; | 		time = now.tv_sec * 1000 + now.tv_nsec / 1000000; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	/* If surface is already focused, only notify of motion */ | 	/* Let the client know that the mouse cursor has entered one
 | ||||||
| 	if (surface == seat->pointer_state.focused_surface) { | 	 * of its surfaces, and make keyboard focus follow if desired. | ||||||
| 		wlr_seat_pointer_notify_motion(seat, time, sx, sy); | 	 * wlroots makes this a no-op if surface is already focused */ | ||||||
| 		return; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	/* Otherwise, let the client know that the mouse cursor has entered one
 |  | ||||||
| 	 * of its surfaces, and make keyboard focus follow if desired. */ |  | ||||||
| 	wlr_seat_pointer_notify_enter(seat, surface, sx, sy); | 	wlr_seat_pointer_notify_enter(seat, surface, sx, sy); | ||||||
|  | 	wlr_seat_pointer_notify_motion(seat, time, sx, sy); | ||||||
| 
 | 
 | ||||||
| 	if (!c || client_is_unmanaged(c)) |  | ||||||
| 		return; |  | ||||||
| 
 |  | ||||||
| 	if (sloppyfocus && !internal_call) |  | ||||||
| 		focusclient(c, 0); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| @ -1442,10 +1457,14 @@ printstatus(void) | |||||||
| 				urg |= c->tags; | 				urg |= c->tags; | ||||||
| 		} | 		} | ||||||
| 		if ((c = focustop(m))) { | 		if ((c = focustop(m))) { | ||||||
| 			printf("%s title %s\n", m->wlr_output->name, client_get_title(focustop(m))); | 			printf("%s title %s\n", m->wlr_output->name, client_get_title(c)); | ||||||
|  | 			printf("%s fullscreen %u\n", m->wlr_output->name, c->isfullscreen); | ||||||
|  | 			printf("%s floating %u\n", m->wlr_output->name, c->isfloating); | ||||||
| 			sel = c->tags; | 			sel = c->tags; | ||||||
| 		} else { | 		} else { | ||||||
| 			printf("%s title \n", m->wlr_output->name); | 			printf("%s title \n", m->wlr_output->name); | ||||||
|  | 			printf("%s fullscreen \n", m->wlr_output->name); | ||||||
|  | 			printf("%s floating \n", m->wlr_output->name); | ||||||
| 			sel = 0; | 			sel = 0; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| @ -1476,8 +1495,7 @@ rendermon(struct wl_listener *listener, void *data) | |||||||
| 	 * generally at the output's refresh rate (e.g. 60Hz). */ | 	 * generally at the output's refresh rate (e.g. 60Hz). */ | ||||||
| 	Monitor *m = wl_container_of(listener, m, frame); | 	Monitor *m = wl_container_of(listener, m, frame); | ||||||
| 	Client *c; | 	Client *c; | ||||||
| 	LayerSurface *layer; | 	int skip = 0; | ||||||
| 	int i, skip = 0; |  | ||||||
| 	struct timespec now; | 	struct timespec now; | ||||||
| 
 | 
 | ||||||
| 	/* Render if no XDG clients have an outstanding resize. */ | 	/* Render if no XDG clients have an outstanding resize. */ | ||||||
| @ -1494,11 +1512,13 @@ rendermon(struct wl_listener *listener, void *data) | |||||||
| void | void | ||||||
| resize(Client *c, int x, int y, int w, int h, int interact) | resize(Client *c, int x, int y, int w, int h, int interact) | ||||||
| { | { | ||||||
|  | 	int min_width = 0, min_height = 0; | ||||||
| 	struct wlr_box *bbox = interact ? &sgeom : &c->mon->w; | 	struct wlr_box *bbox = interact ? &sgeom : &c->mon->w; | ||||||
|  | 	client_min_size(c, &min_width, &min_height); | ||||||
| 	c->geom.x = x; | 	c->geom.x = x; | ||||||
| 	c->geom.y = y; | 	c->geom.y = y; | ||||||
| 	c->geom.width = w; | 	c->geom.width = MAX(min_width + 2 * c->bw, w); | ||||||
| 	c->geom.height = h; | 	c->geom.height = MAX(min_height + 2 * c->bw, h); | ||||||
| 	applybounds(c, bbox); | 	applybounds(c, bbox); | ||||||
| 
 | 
 | ||||||
| 	/* Update scene-graph, including borders */ | 	/* Update scene-graph, including borders */ | ||||||
| @ -1612,6 +1632,7 @@ setfloating(Client *c, int floating) | |||||||
| 	c->isfloating = floating; | 	c->isfloating = floating; | ||||||
| 	wlr_scene_node_reparent(c->scene, layers[c->isfloating ? LyrFloat : LyrTile]); | 	wlr_scene_node_reparent(c->scene, layers[c->isfloating ? LyrFloat : LyrTile]); | ||||||
| 	arrange(c->mon); | 	arrange(c->mon); | ||||||
|  | 	printstatus(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| @ -1767,7 +1788,6 @@ setup(void) | |||||||
| 	 */ | 	 */ | ||||||
| 	wl_list_init(&clients); | 	wl_list_init(&clients); | ||||||
| 	wl_list_init(&fstack); | 	wl_list_init(&fstack); | ||||||
| 	wl_list_init(&independents); |  | ||||||
| 
 | 
 | ||||||
| 	idle = wlr_idle_create(dpy); | 	idle = wlr_idle_create(dpy); | ||||||
| 
 | 
 | ||||||
| @ -1826,18 +1846,16 @@ setup(void) | |||||||
| 	wl_signal_add(&virtual_keyboard_mgr->events.new_virtual_keyboard, | 	wl_signal_add(&virtual_keyboard_mgr->events.new_virtual_keyboard, | ||||||
| 			&new_virtual_keyboard); | 			&new_virtual_keyboard); | ||||||
| 	seat = wlr_seat_create(dpy, "seat0"); | 	seat = wlr_seat_create(dpy, "seat0"); | ||||||
| 	wl_signal_add(&seat->events.request_set_cursor, | 	wl_signal_add(&seat->events.request_set_cursor, &request_cursor); | ||||||
| 			&request_cursor); | 	wl_signal_add(&seat->events.request_set_selection, &request_set_sel); | ||||||
| 	wl_signal_add(&seat->events.request_set_selection, | 	wl_signal_add(&seat->events.request_set_primary_selection, &request_set_psel); | ||||||
| 			&request_set_sel); |  | ||||||
| 	wl_signal_add(&seat->events.request_set_primary_selection, |  | ||||||
| 			&request_set_psel); |  | ||||||
| 
 | 
 | ||||||
| 	output_mgr = wlr_output_manager_v1_create(dpy); | 	output_mgr = wlr_output_manager_v1_create(dpy); | ||||||
| 	wl_signal_add(&output_mgr->events.apply, &output_mgr_apply); | 	wl_signal_add(&output_mgr->events.apply, &output_mgr_apply); | ||||||
| 	wl_signal_add(&output_mgr->events.test, &output_mgr_test); | 	wl_signal_add(&output_mgr->events.test, &output_mgr_test); | ||||||
| 
 | 
 | ||||||
| 	presentation = wlr_presentation_create(dpy, backend); | 	presentation = wlr_presentation_create(dpy, backend); | ||||||
|  | 	wlr_scene_set_presentation(scene, presentation); | ||||||
| 
 | 
 | ||||||
| #ifdef XWAYLAND | #ifdef XWAYLAND | ||||||
| 	/*
 | 	/*
 | ||||||
| @ -1909,7 +1927,7 @@ tile(Monitor *m) | |||||||
| 	Client *c; | 	Client *c; | ||||||
| 
 | 
 | ||||||
| 	wl_list_for_each(c, &clients, link) | 	wl_list_for_each(c, &clients, link) | ||||||
| 		if (VISIBLEON(c, m) && !c->isfloating) | 		if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen) | ||||||
| 			n++; | 			n++; | ||||||
| 	if (n == 0) | 	if (n == 0) | ||||||
| 		return; | 		return; | ||||||
| @ -1939,10 +1957,9 @@ void | |||||||
| togglefloating(const Arg *arg) | togglefloating(const Arg *arg) | ||||||
| { | { | ||||||
| 	Client *sel = selclient(); | 	Client *sel = selclient(); | ||||||
| 	if (!sel) |  | ||||||
| 		return; |  | ||||||
| 	/* return if fullscreen */ | 	/* return if fullscreen */ | ||||||
| 	setfloating(sel, !sel->isfloating /* || sel->isfixed */); | 	if (sel && !sel->isfullscreen) | ||||||
|  | 		setfloating(sel, !sel->isfloating); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void | void | ||||||
| @ -2000,10 +2017,13 @@ unmapnotify(struct wl_listener *listener, void *data) | |||||||
| 		cursor_mode = CurNormal; | 		cursor_mode = CurNormal; | ||||||
| 		grabc = NULL; | 		grabc = NULL; | ||||||
| 	} | 	} | ||||||
| 	wl_list_remove(&c->link); |  | ||||||
| 	if (client_is_unmanaged(c)) |  | ||||||
| 		return; |  | ||||||
| 
 | 
 | ||||||
|  | 	if (client_is_unmanaged(c)) { | ||||||
|  | 		wlr_scene_node_destroy(c->scene); | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	wl_list_remove(&c->link); | ||||||
| 	setmon(c, NULL, 0); | 	setmon(c, NULL, 0); | ||||||
| 	wl_list_remove(&c->flink); | 	wl_list_remove(&c->flink); | ||||||
| 	wlr_scene_node_destroy(c->scene); | 	wlr_scene_node_destroy(c->scene); | ||||||
| @ -2190,6 +2210,8 @@ createnotifyx11(struct wl_listener *listener, void *data) | |||||||
| 
 | 
 | ||||||
| 	/* Allocate a Client for this surface */ | 	/* Allocate a Client for this surface */ | ||||||
| 	c = xwayland_surface->data = calloc(1, sizeof(*c)); | 	c = xwayland_surface->data = calloc(1, sizeof(*c)); | ||||||
|  | 	if (!c) | ||||||
|  | 		EBARF("createnotifyx11: calloc"); | ||||||
| 	c->surface.xwayland = xwayland_surface; | 	c->surface.xwayland = xwayland_surface; | ||||||
| 	c->type = xwayland_surface->override_redirect ? X11Unmanaged : X11Managed; | 	c->type = xwayland_surface->override_redirect ? X11Unmanaged : X11Managed; | ||||||
| 	c->bw = borderpx; | 	c->bw = borderpx; | ||||||
| @ -2198,8 +2220,7 @@ createnotifyx11(struct wl_listener *listener, void *data) | |||||||
| 	/* Listen to the various events it can emit */ | 	/* Listen to the various events it can emit */ | ||||||
| 	LISTEN(&xwayland_surface->events.map, &c->map, mapnotify); | 	LISTEN(&xwayland_surface->events.map, &c->map, mapnotify); | ||||||
| 	LISTEN(&xwayland_surface->events.unmap, &c->unmap, unmapnotify); | 	LISTEN(&xwayland_surface->events.unmap, &c->unmap, unmapnotify); | ||||||
| 	LISTEN(&xwayland_surface->events.request_activate, &c->activate, | 	LISTEN(&xwayland_surface->events.request_activate, &c->activate, activatex11); | ||||||
| 			activatex11); |  | ||||||
| 	LISTEN(&xwayland_surface->events.request_configure, &c->configure, | 	LISTEN(&xwayland_surface->events.request_configure, &c->configure, | ||||||
| 			configurex11); | 			configurex11); | ||||||
| 	LISTEN(&xwayland_surface->events.set_title, &c->set_title, updatetitle); | 	LISTEN(&xwayland_surface->events.set_title, &c->set_title, updatetitle); | ||||||
| @ -2268,8 +2289,7 @@ main(int argc, char *argv[]) | |||||||
| 	if (optind < argc) | 	if (optind < argc) | ||||||
| 		goto usage; | 		goto usage; | ||||||
| 
 | 
 | ||||||
| 	// Wayland requires XDG_RUNTIME_DIR for creating its communications
 | 	/* Wayland requires XDG_RUNTIME_DIR for creating its communications socket */ | ||||||
| 	// socket
 |  | ||||||
| 	if (!getenv("XDG_RUNTIME_DIR")) | 	if (!getenv("XDG_RUNTIME_DIR")) | ||||||
| 		BARF("XDG_RUNTIME_DIR must be set"); | 		BARF("XDG_RUNTIME_DIR must be set"); | ||||||
| 	setup(); | 	setup(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Leonardo Hernández Hernández
						Leonardo Hernández Hernández