xdg-shell: Turn "activated" into a state
This drops two events, and makes new window decorations race-free with an attach in-flight.
This commit is contained in:
committed by
Kristian Høgsberg
parent
de6809912e
commit
973d7879e3
@@ -303,16 +303,6 @@ handle_surface_configure(void *data, struct xdg_surface *surface,
|
|||||||
xdg_surface_ack_configure(surface, serial);
|
xdg_surface_ack_configure(surface, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
handle_surface_activated(void *data, struct xdg_surface *xdg_surface)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handle_surface_deactivated(void *data, struct xdg_surface *xdg_surface)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
|
handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
|
||||||
{
|
{
|
||||||
@@ -321,8 +311,6 @@ handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
|
|||||||
|
|
||||||
static const struct xdg_surface_listener xdg_surface_listener = {
|
static const struct xdg_surface_listener xdg_surface_listener = {
|
||||||
handle_surface_configure,
|
handle_surface_configure,
|
||||||
handle_surface_activated,
|
|
||||||
handle_surface_deactivated,
|
|
||||||
handle_surface_delete,
|
handle_surface_delete,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -123,16 +123,6 @@ handle_configure(void *data, struct xdg_surface *surface,
|
|||||||
xdg_surface_ack_configure(surface, serial);
|
xdg_surface_ack_configure(surface, serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
handle_activated(void *data, struct xdg_surface *xdg_surface)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handle_deactivated(void *data, struct xdg_surface *xdg_surface)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_delete(void *data, struct xdg_surface *xdg_surface)
|
handle_delete(void *data, struct xdg_surface *xdg_surface)
|
||||||
{
|
{
|
||||||
@@ -141,8 +131,6 @@ handle_delete(void *data, struct xdg_surface *xdg_surface)
|
|||||||
|
|
||||||
static const struct xdg_surface_listener xdg_surface_listener = {
|
static const struct xdg_surface_listener xdg_surface_listener = {
|
||||||
handle_configure,
|
handle_configure,
|
||||||
handle_activated,
|
|
||||||
handle_deactivated,
|
|
||||||
handle_delete,
|
handle_delete,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+4
-16
@@ -3868,6 +3868,7 @@ handle_surface_configure(void *data, struct xdg_surface *xdg_surface,
|
|||||||
window->maximized = 0;
|
window->maximized = 0;
|
||||||
window->fullscreen = 0;
|
window->fullscreen = 0;
|
||||||
window->resizing = 0;
|
window->resizing = 0;
|
||||||
|
window->focused = 0;
|
||||||
|
|
||||||
wl_array_for_each(p, states) {
|
wl_array_for_each(p, states) {
|
||||||
uint32_t state = *p;
|
uint32_t state = *p;
|
||||||
@@ -3881,6 +3882,9 @@ handle_surface_configure(void *data, struct xdg_surface *xdg_surface,
|
|||||||
case XDG_SURFACE_STATE_RESIZING:
|
case XDG_SURFACE_STATE_RESIZING:
|
||||||
window->resizing = 1;
|
window->resizing = 1;
|
||||||
break;
|
break;
|
||||||
|
case XDG_SURFACE_STATE_ACTIVATED:
|
||||||
|
window->focused = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* Unknown state */
|
/* Unknown state */
|
||||||
break;
|
break;
|
||||||
@@ -3893,20 +3897,6 @@ handle_surface_configure(void *data, struct xdg_surface *xdg_surface,
|
|||||||
window->state_changed_handler(window, window->user_data);
|
window->state_changed_handler(window, window->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
handle_surface_activated(void *data, struct xdg_surface *xdg_surface)
|
|
||||||
{
|
|
||||||
struct window *window = data;
|
|
||||||
window->focused = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
handle_surface_deactivated(void *data, struct xdg_surface *xdg_surface)
|
|
||||||
{
|
|
||||||
struct window *window = data;
|
|
||||||
window->focused = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
|
handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
|
||||||
{
|
{
|
||||||
@@ -3916,8 +3906,6 @@ handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
|
|||||||
|
|
||||||
static const struct xdg_surface_listener xdg_surface_listener = {
|
static const struct xdg_surface_listener xdg_surface_listener = {
|
||||||
handle_surface_configure,
|
handle_surface_configure,
|
||||||
handle_surface_activated,
|
|
||||||
handle_surface_deactivated,
|
|
||||||
handle_surface_delete,
|
handle_surface_delete,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2009,16 +2009,14 @@ static void
|
|||||||
shell_surface_lose_keyboard_focus(struct shell_surface *shsurf)
|
shell_surface_lose_keyboard_focus(struct shell_surface *shsurf)
|
||||||
{
|
{
|
||||||
if (--shsurf->focus_count == 0)
|
if (--shsurf->focus_count == 0)
|
||||||
if (shell_surface_is_xdg_surface(shsurf))
|
shell_surface_state_changed(shsurf);
|
||||||
xdg_surface_send_deactivated(shsurf->resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shell_surface_gain_keyboard_focus(struct shell_surface *shsurf)
|
shell_surface_gain_keyboard_focus(struct shell_surface *shsurf)
|
||||||
{
|
{
|
||||||
if (shsurf->focus_count++ == 0)
|
if (shsurf->focus_count++ == 0)
|
||||||
if (shell_surface_is_xdg_surface(shsurf))
|
shell_surface_state_changed(shsurf);
|
||||||
xdg_surface_send_activated(shsurf->resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -3557,6 +3555,10 @@ xdg_send_configure(struct weston_surface *surface,
|
|||||||
s = wl_array_add(&states, sizeof *s);
|
s = wl_array_add(&states, sizeof *s);
|
||||||
*s = XDG_SURFACE_STATE_RESIZING;
|
*s = XDG_SURFACE_STATE_RESIZING;
|
||||||
}
|
}
|
||||||
|
if (shsurf->focus_count > 0) {
|
||||||
|
s = wl_array_add(&states, sizeof *s);
|
||||||
|
*s = XDG_SURFACE_STATE_ACTIVATED;
|
||||||
|
}
|
||||||
|
|
||||||
serial = wl_display_next_serial(shsurf->surface->compositor->wl_display);
|
serial = wl_display_next_serial(shsurf->surface->compositor->wl_display);
|
||||||
xdg_surface_send_configure(shsurf->resource, width, height, &states, serial);
|
xdg_surface_send_configure(shsurf->resource, width, height, &states, serial);
|
||||||
|
|||||||
+5
-22
@@ -276,6 +276,11 @@
|
|||||||
Clients that have aspect ratio or cell sizing configuration can use
|
Clients that have aspect ratio or cell sizing configuration can use
|
||||||
a smaller size, however.
|
a smaller size, however.
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry name="activated" value="4">
|
||||||
|
Client window decorations should be painted as if the window is
|
||||||
|
active. Do not assume this means that the window actually has
|
||||||
|
keyboard or pointer focus.
|
||||||
|
</entry>
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
<event name="configure">
|
<event name="configure">
|
||||||
@@ -331,28 +336,6 @@
|
|||||||
|
|
||||||
<request name="set_minimized" />
|
<request name="set_minimized" />
|
||||||
|
|
||||||
<event name="activated">
|
|
||||||
<description summary="surface was activated">
|
|
||||||
The activated_set event is sent when this surface has been
|
|
||||||
activated, which means that the surface has user attention.
|
|
||||||
Window decorations should be updated accordingly. You should
|
|
||||||
not use this event for anything but the style of decorations
|
|
||||||
you display, use wl_keyboard.enter and wl_keyboard.leave for
|
|
||||||
determining keyboard focus.
|
|
||||||
</description>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="deactivated">
|
|
||||||
<description summary="surface was deactivated">
|
|
||||||
The deactivate event is sent when this surface has been
|
|
||||||
deactivated, which means that the surface lost user attention.
|
|
||||||
Window decorations should be updated accordingly. You should
|
|
||||||
not use this event for anything but the style of decorations
|
|
||||||
you display, use wl_keyboard.enter and wl_keyboard.leave for
|
|
||||||
determining keyboard focus.
|
|
||||||
</description>
|
|
||||||
</event>
|
|
||||||
|
|
||||||
<event name="close">
|
<event name="close">
|
||||||
<description summary="surface wants to be closed">
|
<description summary="surface wants to be closed">
|
||||||
The close event is sent by the compositor when the user
|
The close event is sent by the compositor when the user
|
||||||
|
|||||||
Reference in New Issue
Block a user