summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2014-02-19 16:56:43 -0800
committerKristian Høgsberg <krh@bitplanet.net>2014-02-19 16:56:43 -0800
commit8b2a77122ad262d344fc72faff3e6b41ee649827 (patch)
tree24cde9d83619b5ae4828dfbada438aeac8ffdc0d
parent808c4225d478448c8b841e4a4cfcef91bfaaf809 (diff)
active as a statexdg-more-states
-rw-r--r--clients/simple-egl.c12
-rw-r--r--clients/simple-shm.c12
-rw-r--r--clients/window.c19
-rw-r--r--desktop-shell/shell.c29
-rw-r--r--protocol/xdg-shell.xml25
5 files changed, 29 insertions, 68 deletions
diff --git a/clients/simple-egl.c b/clients/simple-egl.c
index 5c6077da..fa0921c7 100644
--- a/clients/simple-egl.c
+++ b/clients/simple-egl.c
@@ -303,16 +303,6 @@ handle_surface_change_state(void *data, struct xdg_surface *xdg_surface,
}
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
handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
{
running = 0;
@@ -321,8 +311,6 @@ handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
static const struct xdg_surface_listener xdg_surface_listener = {
handle_surface_configure,
handle_surface_change_state,
- handle_surface_activated,
- handle_surface_deactivated,
handle_surface_delete,
};
diff --git a/clients/simple-shm.c b/clients/simple-shm.c
index 02960286..dce3c683 100644
--- a/clients/simple-shm.c
+++ b/clients/simple-shm.c
@@ -128,16 +128,6 @@ handle_change_state(void *data, struct xdg_surface *xdg_surface,
}
static void
-handle_activated(void *data, struct xdg_surface *xdg_surface)
-{
-}
-
-static void
-handle_deactivated(void *data, struct xdg_surface *xdg_surface)
-{
-}
-
-static void
handle_delete(void *data, struct xdg_surface *xdg_surface)
{
running = 0;
@@ -146,8 +136,6 @@ handle_delete(void *data, struct xdg_surface *xdg_surface)
static const struct xdg_surface_listener xdg_surface_listener = {
handle_configure,
handle_change_state,
- handle_activated,
- handle_deactivated,
handle_delete,
};
diff --git a/clients/window.c b/clients/window.c
index cf76929a..fa2c5ceb 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3856,6 +3856,9 @@ handle_surface_change_state(void *data, struct xdg_surface *xdg_surface,
case XDG_SURFACE_STATE_FULLSCREEN:
window->fullscreen = value;
break;
+ case XDG_SURFACE_STATE_ACTIVE:
+ window->focused = value;
+ break;
}
if (!window->fullscreen && !window->maximized)
@@ -3868,20 +3871,6 @@ handle_surface_change_state(void *data, struct xdg_surface *xdg_surface,
}
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
handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
{
struct window *window = data;
@@ -3891,8 +3880,6 @@ handle_surface_delete(void *data, struct xdg_surface *xdg_surface)
static const struct xdg_surface_listener xdg_surface_listener = {
handle_surface_configure,
handle_surface_change_state,
- handle_surface_activated,
- handle_surface_deactivated,
handle_surface_delete,
};
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index c764a2c5..92476c21 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1961,17 +1961,29 @@ create_pointer_focus_listener(struct weston_seat *seat)
static void
shell_surface_lose_keyboard_focus(struct shell_surface *shsurf)
{
- if (--shsurf->focus_count == 0)
- if (shell_surface_is_xdg_surface(shsurf))
- xdg_surface_send_deactivated(shsurf->resource);
+ struct weston_compositor *compositor = shsurf->shell->compositor;
+ uint32_t serial;
+
+ if (--shsurf->focus_count == 0 &&
+ shell_surface_is_xdg_surface(shsurf)) {
+ serial = wl_display_next_serial(compositor->wl_display);
+ xdg_surface_change_state(shsurf, XDG_SURFACE_STATE_ACTIVE,
+ 0, serial);
+ }
}
static void
shell_surface_gain_keyboard_focus(struct shell_surface *shsurf)
{
- if (shsurf->focus_count++ == 0)
- if (shell_surface_is_xdg_surface(shsurf))
- xdg_surface_send_activated(shsurf->resource);
+ struct weston_compositor *compositor = shsurf->shell->compositor;
+ uint32_t serial;
+
+ if (shsurf->focus_count++ == 0 &&
+ shell_surface_is_xdg_surface(shsurf)) {
+ serial = wl_display_next_serial(compositor->wl_display);
+ xdg_surface_change_state(shsurf, XDG_SURFACE_STATE_ACTIVE,
+ 1, serial);
+ }
}
static void
@@ -3297,6 +3309,8 @@ xdg_surface_change_state(struct shell_surface *shsurf,
break;
case XDG_SURFACE_STATE_RESIZING:
break;
+ case XDG_SURFACE_STATE_ACTIVE:
+ break;
}
}
@@ -3319,6 +3333,9 @@ xdg_surface_request_change_state(struct wl_client *client,
case XDG_SURFACE_STATE_MAXIMIZED:
case XDG_SURFACE_STATE_FULLSCREEN:
break;
+ case XDG_SURFACE_STATE_RESIZING:
+ case XDG_SURFACE_STATE_ACTIVE:
+ return;
default:
/* send error? ignore? send change state with value 0? */
return;
diff --git a/protocol/xdg-shell.xml b/protocol/xdg-shell.xml
index 06496655..dbf7c253 100644
--- a/protocol/xdg-shell.xml
+++ b/protocol/xdg-shell.xml
@@ -310,6 +310,9 @@
<entry name="resizing" value="3" summary="the surface is being resized">
A non-zero value indicates the surface is being resized.
</entry>
+ <entry name="active" value="4" summary="the surface is active">
+ A non-zero value indicates the surface is active.
+ </entry>
</enum>
<request name="request_change_state">
@@ -363,28 +366,6 @@
</description>
</request>
- <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="delete">
<description summary="surface wants to be closed">
The delete event is sent by the compositor when the user