Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • guido.gunther/phoc
  • dorota.czaplejewicz/phoc
  • sebastian.krzyszkowiak/phoc
  • jeremiah.foster/phoc
  • PureTryOut/phoc
  • njha/phoc
  • nfraprado/phoc
  • devrtz/phoc
  • masipcat/phoc
  • louib/phoc
  • marty1885/phoc
  • nobodyinperson/phoc
  • anteater/phoc
  • lipu/phoc
  • craftyguy/phoc
  • alice.mikhaylenko/phoc
  • zhaofengli/phoc
17 results
Show changes
Commits on Source (5)
phoc (0.4.1) amber-phone; urgency=high
[ Sebastian Krzyszkowiak ]
* render: Rework damage tracking debug mode
* render: Use G_(UN)LIKELY for debug flags
* render: Use defines for color values
* cursor: Put a touched view into focus
* debian: Add sign-tags=true to gbp.conf
* gitlab-ci: Un-silence grep invocations
* gitlab-ci: Set package jobs dependencies to empty
* render: Don't try to render a surface with no texture
* cursor: Avoid damaging the whole output in touch points debug mode
* render: Catch up with wlroots' wlr_client_buffer
* render: Make the EGL context current when rendering to texture
[ &t ]
* Add --version flag
[ Yann Büchau ]
* scale-to-fit: Default to "on" without extra argument
-- Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm> Wed, 22 Jul 2020 15:47:52 +0200
phoc (0.4.0) amber-phone; urgency=high
[ Guido Günther ]
......
......@@ -42,6 +42,7 @@ Build-Depends:
Standards-Version: 4.1.3
Section: libs
Homepage: https://source.puri.sm/librem5/phoc
Rules-Requires-Root: no
Package: phoc
Architecture: any
......
<protocol name="phosh">
<interface name="phosh_private" version="4">
<interface name="phosh_private" version="5">
<description summary="Phone shell extensions">
Private protocol between phosh and the compositor.
</description>
......@@ -26,7 +26,7 @@
<description summary="request a window thumbnail for a given toplevel">
Allows to retrieve a window thumbnail image for a given foreign
toplevel via wlr_screencopy protocol.
The thumbnail will be scaled down to the size provided by
max_width and max_height arguments, preserving original aspect
ratio. Pass 0 to leave it unconstrained.
......@@ -36,6 +36,90 @@
<arg name="max_width" type="uint" />
<arg name="max_height" type="uint" />
</request>
<request name="get_keyboard_event" since="5">
<description summary="request a keyboard event handler">
Allows to subscribe to specific keyboard events.
The client grabs an accelerator by a string and gets an action id returned.
When the accelerator is used the client will be informed via the corresponding
action id.
</description>
<arg name="id" type="new_id" interface="phosh_private_keyboard_event"/>
</request>
</interface>
<interface name="phosh_private_keyboard_event" version="5">
<description summary="Interface for additional keyboard events">
The interface is meant to allow subscription and forwarding of keyboard events.
</description>
<enum name="error">
<entry name="invalid_argument" value="0"
summary="an invalid argument was provided in a request"/>
<entry name="invalid_keysym" value="1"
summary="keysym not subscribeable"/>
<entry name="already_subscribed" value="2"
summary="accelerator has already been subscribed to"/>
<entry name="misc_error" value="3"
summary="an miscellaneous error has occured"/>
</enum>
<event name="accelerator_activated_event" since="5">
<description summary="Report an accelerator press">
Forward an action to the client.
</description>
<arg name="action_id" type="uint" summary="The previously assigned action_id"/>
<arg name="timestamp" type="uint" summary="The timestamp when the key has been pressed"/>
</event>
<event name="grab_failed_event" since="5">
<description summary="Report subscription failure">
A previous accelerator grab request has failed.
</description>
<arg name="accelerator" type="string" summary="The failed accelerator"/>
<arg name="error" type="uint" summary="The error code"/>
</event>
<event name="grab_success_event" since="5">
<description summary="Report subscription success">
A previous accelerator grab request has succeeded.
</description>
<arg name="accelerator" type="string" summary="The subscribed accelerator"/>
<arg name="action_id" type="uint" summary="The id that has been assigned to the accelerator"/>
</event>
<request name="grab_accelerator_request" since="5">
<description summary="Subscribe to an accelerator">
Client subscribes to a specific accelerator.
</description>
<arg name="accelerator" type="string" summary="The accelerator string (with modifiers)"/>
</request>
<event name="ungrab_failed_event" since="5">
<description summary="Report unsubscription failure">
A previous accelerator ungrab request has failed.
</description>
<arg name="action_id" type="uint" summary="The failed action"/>
<arg name="error" type="uint" summary="The error code"/>
</event>
<event name="ungrab_success_event" since="5">
<description summary="Report unsubscription success">
A previous accelerator ungrab request has suceeded.
</description>
<arg name="action" type="uint" summary="The unsubscribed action"/>
</event>
<request name="ungrab_accelerator_request" since="5">
<description summary="Unsubscribe to an accelerator">
Client unsubscribes a specific accelerator"
</description>
<arg name="action_id" type="uint" summary="The action to unsubscribe"/>
</request>
<request name="destroy" type="destructor" since="5">
<description summary="destroy the keyboard_event interface instance"/>
</request>
</interface>
<!-- application switch/close handling -->
......
......@@ -20,17 +20,6 @@
typedef void (*PhocKeyHandlerFunc) (struct roots_seat *);
/**
* PhocKeyCombo:
*
* A combination of modifiers and a key describing a keyboard shortcut
*/
typedef struct
{
guint32 modifiers;
xkb_keysym_t keysym;
} PhocKeyCombo;
typedef struct
{
......@@ -298,7 +287,7 @@ is_keycode (const gchar *string)
g_ascii_isxdigit (string[3]));
}
static PhocKeyCombo *
PhocKeyCombo *
parse_accelerator (const gchar *accelerator)
{
PhocKeyCombo *combo;
......
......@@ -19,10 +19,22 @@ G_DECLARE_FINAL_TYPE (PhocKeybindings, phoc_keybindings, PHOC, KEYBINDINGS, GObj
PhocKeybindings *phoc_keybindings_new (void);
/**
* PhocKeyCombo:
*
* A combination of modifiers and a key describing a keyboard shortcut
*/
typedef struct
{
guint32 modifiers;
xkb_keysym_t keysym;
} PhocKeyCombo;
struct roots_seat;
gboolean phoc_keybindings_handle_pressed (PhocKeybindings *self,
guint32 modifiers,
xkb_keysym_t *pressed_keysyms,
guint32 length,
struct roots_seat *seat);
PhocKeyCombo *parse_accelerator (const gchar * accelerator);
G_END_DECLS
......@@ -14,6 +14,7 @@
#include <wlr/util/log.h>
#include <xkbcommon/xkbcommon.h>
#include "keyboard.h"
#include "phosh.h"
#include "seat.h"
#include <glib.h>
......@@ -231,6 +232,29 @@ keyboard_execute_binding(PhocKeyboard *self,
return false;
}
/**
* Forward keyboard bindings.
*
* Returns true if the keysym was handled by forwarding and false if the event
* should be propagated to clients.
*/
static bool
keyboard_execute_subscribed_binding(PhocKeyboard *self,
xkb_keysym_t *pressed_keysyms, uint32_t modifiers,
const xkb_keysym_t *keysyms, size_t keysyms_len,
uint32_t time)
{
bool handled = false;
for (size_t i = 0; i < keysyms_len; ++i) {
PhocKeyCombo combo = { modifiers, keysyms[i] };
handled = handled |
phosh_forward_keysym (&combo,
time);
}
return handled;
}
/*
* Get keysyms and modifiers from the keyboard as xkb sees them.
*
......@@ -307,6 +331,13 @@ phoc_keyboard_handle_key(PhocKeyboard *self,
self->pressed_keysyms_raw, modifiers, keysyms, keysyms_len);
}
// Handle subscribed keysyms
if (event->state == WLR_KEY_PRESSED && !handled) {
handled = keyboard_execute_subscribed_binding (self,
self->pressed_keysyms_raw, modifiers,
keysyms, keysyms_len, event->time_msec);
}
if (!handled) {
wlr_seat_set_keyboard(self->seat->seat, self->device);
wlr_seat_keyboard_notify_key(self->seat->seat, event->time_msec,
......
......@@ -25,7 +25,15 @@
#include "phosh.h"
#include "render.h"
#define PHOSH_PRIVATE_VERSION 4
struct phosh_private_keyboard_event_data {
GHashTable *subscribed_accelerators;
struct wl_resource *resource;
struct phosh_private *phosh;
};
static struct phosh_private_keyboard_event_data *phosh_private_keyboard_event_from_resource(struct wl_resource *resource);
#define PHOSH_PRIVATE_VERSION 5
static
void
......@@ -113,6 +121,202 @@ handle_get_xdg_switcher (struct wl_client *client,
"Use wlr-toplevel-management protocol instead");
}
static void
phosh_private_keyboard_event_destroy (struct phosh_private_keyboard_event_data *kbevent)
{
struct phosh_private *phosh;
if (kbevent == NULL)
return;
g_debug ("Destroying private_keyboard_event %p (res %p)", kbevent, kbevent->resource);
phosh = kbevent->phosh;
g_hash_table_remove_all (kbevent->subscribed_accelerators);
g_hash_table_unref (kbevent->subscribed_accelerators);
wl_resource_set_user_data (kbevent->resource, NULL);
phosh->keyboard_events = g_list_remove (phosh->keyboard_events, kbevent);
g_free (kbevent);
}
static void
phosh_private_keyboard_event_handle_resource_destroy (struct wl_resource *resource)
{
struct phosh_private_keyboard_event_data * kbevent =
phosh_private_keyboard_event_from_resource (resource);
phosh_private_keyboard_event_destroy (kbevent);
}
static bool
phosh_private_keyboard_event_accelerator_is_registered (PhocKeyCombo *combo,
struct phosh_private_keyboard_event_data *kbevent)
{
gint64 key = ((gint64) combo->modifiers << 32) | combo->keysym;
gpointer ret = g_hash_table_lookup (kbevent->subscribed_accelerators, &key);
g_debug ("Accelerator is registered: Lookup -> %p", ret);
return (ret != NULL);
}
static bool
phosh_private_accelerator_already_subscribed (PhocKeyCombo *combo)
{
GList *l;
struct phosh_private_keyboard_event_data *kbevent;
PhocServer *server = phoc_server_get_default ();
struct phosh_private *phosh_private;
phosh_private = server->desktop->phosh;
for (l = phosh_private->keyboard_events; l != NULL; l = l->next) {
kbevent = (struct phosh_private_keyboard_event_data *)l->data;
if (phosh_private_keyboard_event_accelerator_is_registered (combo, kbevent))
return true;
}
return false;
}
static bool
keysym_is_media (xkb_keysym_t keysym)
{
switch (keysym) {
case XKB_KEY_XF86AudioLowerVolume:
case XKB_KEY_XF86AudioRaiseVolume:
case XKB_KEY_XF86AudioMute:
case XKB_KEY_XF86AudioMicMute:
case XKB_KEY_XF86AudioPlay:
case XKB_KEY_XF86AudioPause:
case XKB_KEY_XF86AudioStop:
case XKB_KEY_XF86AudioNext:
case XKB_KEY_XF86AudioPrev:
return true;
default:
return false;
}
}
static bool
keysym_is_subscribeable (xkb_keysym_t keysym)
{
return keysym_is_media (keysym);
}
static void
phosh_private_keyboard_event_grab_accelerator_request (struct wl_client *wl_client,
struct wl_resource *resource,
const char *accelerator)
{
guint new_action_id;
gint64 *new_key;
struct phosh_private_keyboard_event_data *kbevent = phosh_private_keyboard_event_from_resource (resource);
g_autofree PhocKeyCombo *combo = parse_accelerator (accelerator);
if (kbevent == NULL)
return;
if (phosh_private_accelerator_already_subscribed (combo)) {
g_debug ("Accelerator %s already subscribed to!", accelerator);
phosh_private_keyboard_event_send_grab_failed_event (resource,
accelerator,
PHOSH_PRIVATE_KEYBOARD_EVENT_ERROR_ALREADY_SUBSCRIBED);
return;
}
if (!keysym_is_subscribeable (combo->keysym)) {
g_debug ("Requested keysym %s is not subscribeable!", accelerator);
phosh_private_keyboard_event_send_grab_failed_event (resource,
accelerator,
PHOSH_PRIVATE_KEYBOARD_EVENT_ERROR_INVALID_KEYSYM);
return;
}
new_action_id = kbevent->phosh->last_action_id++;
/* detect wrap-around and make sure we fail from here on out */
if (new_action_id == 0) {
g_debug ("Action ID wrap-around detected while trying to subscribe %s", accelerator);
phosh_private_keyboard_event_send_grab_failed_event (resource,
accelerator,
PHOSH_PRIVATE_KEYBOARD_EVENT_ERROR_MISC_ERROR);
kbevent->phosh->last_action_id--;
return;
}
new_key = (gint64 *) g_malloc (sizeof (gint64));
*new_key = ((gint64) combo->modifiers << 32) | combo->keysym;
/* subscribed accelerators of kbevent */
g_hash_table_insert (kbevent->subscribed_accelerators,
new_key, GUINT_TO_POINTER (new_action_id));
phosh_private_keyboard_event_send_grab_success_event (resource,
accelerator,
new_action_id);
g_debug ("Registered accelerator %s (sym %d mod %d) on phosh_private_keyboard_event %p (client %p)",
accelerator, combo->keysym, combo->modifiers, kbevent, wl_client);
}
static void
phosh_private_keyboard_event_handle_destroy (struct wl_client *client,
struct wl_resource *resource)
{
wl_resource_destroy (resource);
}
static const struct phosh_private_keyboard_event_interface phosh_private_keyboard_event_impl = {
.grab_accelerator_request = phosh_private_keyboard_event_grab_accelerator_request,
.destroy = phosh_private_keyboard_event_handle_destroy
};
static void
handle_get_keyboard_event (struct wl_client *client,
struct wl_resource *phosh_private_resource,
uint32_t id)
{
struct phosh_private_keyboard_event_data *kbevent =
g_new0 (struct phosh_private_keyboard_event_data, 1);
if (kbevent == NULL) {
wl_client_post_no_memory (client);
return;
}
int version = wl_resource_get_version (phosh_private_resource);
kbevent->resource = wl_resource_create (client, &phosh_private_keyboard_event_interface, version, id);
if (kbevent->resource == NULL) {
g_free (kbevent);
wl_client_post_no_memory (client);
return;
}
kbevent->subscribed_accelerators = g_hash_table_new_full (g_int64_hash,
g_int64_equal,
g_free, NULL);
if (kbevent->subscribed_accelerators == NULL) {
wl_resource_destroy (kbevent->resource);
g_free (kbevent);
wl_client_post_no_memory (client);
return;
}
struct phosh_private *phosh_private = phosh_private_from_resource (phosh_private_resource);
phosh_private->keyboard_events = g_list_append (phosh_private->keyboard_events, kbevent);
g_debug ("new phosh_private_keyboard_event %p (res %p)", kbevent, kbevent->resource);
wl_resource_set_implementation (kbevent->resource,
&phosh_private_keyboard_event_impl,
kbevent,
phosh_private_keyboard_event_handle_resource_destroy);
kbevent->phosh = phosh_private;
}
static void
phosh_private_screencopy_frame_handle_resource_destroy (struct wl_resource *resource)
......@@ -301,16 +505,20 @@ phosh_handle_resource_destroy (struct wl_resource *resource)
{
struct phosh_private *phosh = wl_resource_get_user_data (resource);
g_debug ("Destroying phosh %p (res %p)", phosh, resource);
phosh->resource = NULL;
phosh->panel = NULL;
g_debug ("Destroying phosh %p (res %p)", phosh, resource);
g_list_free (phosh->keyboard_events);
phosh->keyboard_events = NULL;
}
static const struct phosh_private_interface phosh_private_impl = {
phosh_rotate_display,
handle_get_xdg_switcher,
handle_get_thumbnail
handle_get_thumbnail,
handle_get_keyboard_event
};
......@@ -359,6 +567,7 @@ phosh_create (PhocDesktop *desktop, struct wl_display *display)
g_info ("Initializing phosh private interface");
phosh->global = wl_global_create (display, &phosh_private_interface, PHOSH_PRIVATE_VERSION, phosh, phosh_bind);
phosh->last_action_id = 1;
if (!phosh->global) {
return NULL;
}
......@@ -391,3 +600,40 @@ phosh_private_screencopy_frame_from_resource (struct wl_resource *resource)
&phosh_private_screencopy_frame_impl));
return wl_resource_get_user_data (resource);
}
static struct phosh_private_keyboard_event_data *
phosh_private_keyboard_event_from_resource (struct wl_resource *resource)
{
assert (wl_resource_instance_of (resource, &phosh_private_keyboard_event_interface,
&phosh_private_keyboard_event_impl));
return wl_resource_get_user_data (resource);
}
bool
phosh_forward_keysym (PhocKeyCombo *combo,
uint32_t timestamp)
{
GList *l;
struct phosh_private_keyboard_event_data *kbevent;
PhocServer *server = phoc_server_get_default ();
struct phosh_private *phosh_private;
phosh_private = server->desktop->phosh;
bool forwarded = false;
for (l = phosh_private->keyboard_events; l != NULL; l = l->next) {
kbevent = l->data;
g_debug("addr of kbevent and res kbev %p res %p", kbevent, kbevent->resource);
/* forward the keysym if it is has been subscribed to */
if (phosh_private_keyboard_event_accelerator_is_registered (combo, kbevent)) {
gint64 key = ((gint64)combo->modifiers << 32) | combo->keysym;
guint action_id = GPOINTER_TO_UINT (g_hash_table_lookup (kbevent->subscribed_accelerators, &key));
phosh_private_keyboard_event_send_accelerator_activated_event (kbevent->resource,
action_id,
timestamp);
forwarded = true;
}
}
return forwarded;
}
......@@ -6,12 +6,16 @@
#pragma once
#include <wlr/types/wlr_layer_shell_v1.h>
#include <gmodule.h>
#include "keybindings.h"
#define PHOSH_PRIVATE_XDG_SWITCHER_SINCE_VERSION 2
struct phosh_private {
struct wl_resource* resource;
struct wl_global *global;
GList *keyboard_events;
guint last_action_id;
PhocDesktop *desktop;
struct {
......@@ -41,3 +45,5 @@ void phosh_destroy(struct phosh_private *shell);
struct phosh_private *phosh_private_from_resource(struct wl_resource *resource);
struct phosh_private_xdg_switcher *phosh_private_xdg_switcher_from_resource(struct wl_resource *resource);
struct phosh_private_screencopy_frame *phosh_private_screencopy_frame_from_resource(struct wl_resource *resource);
bool phosh_forward_keysym (PhocKeyCombo *combo, uint32_t timestamp);
......@@ -10,12 +10,14 @@
#include <wlr/backend.h>
#include <wlr/config.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/gles2.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_matrix.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h>
#include <wlr/util/region.h>
#include <wlr/version.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include "layers.h"
......@@ -285,9 +287,13 @@ static bool scan_out_fullscreen_view(struct roots_output *output) {
wlr_presentation_surface_sampled(output->desktop->presentation, surface);
#if WLR_VERSION_MAJOR == 0 && WLR_VERSION_MINOR < 11
if (!wlr_output_attach_buffer(wlr_output, surface->buffer)) {
return false;
}
#else
wlr_output_attach_buffer(wlr_output, &surface->buffer->base);
#endif
return wlr_output_commit(wlr_output);
}
......@@ -433,8 +439,13 @@ view_render_to_buffer (struct roots_view *view, int width, int height, int strid
{
PhocServer *server = phoc_server_get_default ();
struct wlr_surface *surface = view->wlr_surface;
struct wlr_egl *egl = wlr_gles2_renderer_get_egl (server->renderer);
GLuint tex, fbo;
if (!wlr_egl_make_current (egl, EGL_NO_SURFACE, NULL)) {
return;
}
glGenTextures (1, &tex);
glBindTexture (GL_TEXTURE_2D, tex);
glTexImage2D (GL_TEXTURE_2D, 0, GL_BGRA_EXT, width, height, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, NULL);
......@@ -454,6 +465,10 @@ view_render_to_buffer (struct roots_view *view, int width, int height, int strid
glDeleteFramebuffers (1, &fbo);
glDeleteTextures (1, &tex);
glBindFramebuffer (GL_FRAMEBUFFER, 0);
#if WLR_VERSION_MAJOR > 0 || WLR_VERSION_MINOR >= 11
wlr_egl_unset_current (egl);
#endif
}
static void surface_send_frame_done_iterator(struct roots_output *output,
......
......@@ -26,6 +26,14 @@ typedef struct _PhocTestThumbnail
guint32 width, height;
} PhocTestThumbnail;
typedef struct _PhocTestKeyboardEvent
{
char *title;
struct phosh_private_keyboard_event *kbevent;
gboolean test_grab_successful;
gboolean test_grab_unsuccesful;
} PhocTestKeyboardEvent;
static void
xdg_surface_handle_configure(void *data, struct xdg_surface *xdg_surface,
uint32_t serial)
......@@ -177,11 +185,119 @@ test_phosh_thumbnail_simple (void)
phoc_test_client_run (3, &iface, GINT_TO_POINTER (FALSE));
}
static void
keyboard_event_handle_grab_failed (void *data,
struct phosh_private_keyboard_event *kbevent,
const char *accelerator,
uint32_t error)
{
PhocTestKeyboardEvent *kbe = data;
g_assert_nonnull (kbevent);
g_assert (kbe->kbevent == kbevent);
kbe->test_grab_unsuccesful = TRUE;
}
static void
keyboard_event_handle_grab_success (void *data,
struct phosh_private_keyboard_event *kbevent,
const char *accelerator,
uint32_t action_id)
{
PhocTestKeyboardEvent *kbe = data;
g_assert_nonnull (kbevent);
g_assert (kbe->kbevent == kbevent);
if (action_id > 0)
kbe->test_grab_successful = TRUE;
}
static const struct phosh_private_keyboard_event_listener keyboard_event_listener = {
.grab_failed_event = keyboard_event_handle_grab_failed,
.grab_success_event = keyboard_event_handle_grab_success,
};
static PhocTestKeyboardEvent *
phoc_test_keyboard_event_new (PhocTestClientGlobals *globals,
char* title)
{
PhocTestKeyboardEvent *kbe = g_malloc0 (sizeof (PhocTestKeyboardEvent));
g_assert (phosh_private_get_version (globals->phosh) >= 5);
kbe->kbevent = phosh_private_get_keyboard_event (globals->phosh);
kbe->title = title;
phosh_private_keyboard_event_add_listener (kbe->kbevent, &keyboard_event_listener, kbe);
return kbe;
}
static gboolean
test_client_phosh_kbevent_simple (PhocTestClientGlobals *globals, gpointer unused)
{
PhocTestKeyboardEvent *test1;
PhocTestKeyboardEvent *test2;
gchar *test_accelerators[] = {
"XF86AudioLowerVolume",
"XF86AudioRaiseVolume",
"<SHIFT>XF86AudioLowerVolume",
"F9",
};
test1 = phoc_test_keyboard_event_new (globals, "test-mediakey-grabbing");
test2 = phoc_test_keyboard_event_new (globals, "test-invalid-grabbing");
phosh_private_keyboard_event_grab_accelerator_request (test1->kbevent, test_accelerators[0]);
phosh_private_keyboard_event_grab_accelerator_request (test2->kbevent, test_accelerators[3]);
wl_display_dispatch (globals->display);
wl_display_roundtrip (globals->display);
g_assert_true (test1->test_grab_successful);
g_assert_true (test2->test_grab_unsuccesful);
test1->test_grab_successful = FALSE;
test2->test_grab_unsuccesful = FALSE;
phosh_private_keyboard_event_grab_accelerator_request (test1->kbevent, test_accelerators[1]);
phosh_private_keyboard_event_grab_accelerator_request (test2->kbevent, test_accelerators[1]);
wl_display_dispatch (globals->display);
wl_display_roundtrip (globals->display);
g_assert_true (test1->test_grab_successful);
g_assert_true (test2->test_grab_unsuccesful);
test1->test_grab_successful = FALSE;
phosh_private_keyboard_event_grab_accelerator_request (test1->kbevent, test_accelerators[2]);
wl_display_dispatch (globals->display);
wl_display_roundtrip (globals->display);
g_assert_true (test1->test_grab_successful);
phosh_private_keyboard_event_destroy (test1->kbevent);
phosh_private_keyboard_event_destroy (test2->kbevent);
return TRUE;
}
static void
test_phosh_kbevents_simple (void)
{
PhocTestClientIface iface = {
.client_run = test_client_phosh_kbevent_simple,
};
phoc_test_client_run (3, &iface, NULL);
}
gint
main (gint argc, gchar *argv[])
{
g_test_init (&argc, &argv, NULL);
g_test_add_func("/phoc/phosh/thumbnail/simple", test_phosh_thumbnail_simple);
return g_test_run();
g_test_add_func ("/phoc/phosh/thumbnail/simple", test_phosh_thumbnail_simple);
g_test_add_func ("/phoc/phosh/kbevents/simple", test_phosh_kbevents_simple);
return g_test_run ();
}
......@@ -318,7 +318,7 @@ static void registry_handle_global(void *data, struct wl_registry *registry,
zwlr_foreign_toplevel_manager_v1_add_listener (globals->foreign_toplevel_manager,
&foreign_toplevel_manager_listener, globals);
} else if (!g_strcmp0 (interface, phosh_private_interface.name)) {
globals->phosh = wl_registry_bind (registry, name, &phosh_private_interface, 4);
globals->phosh = wl_registry_bind (registry, name, &phosh_private_interface, 5);
}
}
......