gtk2/gdk/broadway/gdkbroadway-server.h
Alexander Larsson ddade66496 broadway: use 'click-to-focus' approach instead of 'focus-follows-mouse'
The broadway backend would move the focus from one window to another based on
where the mouse was (i.e. 'focus-follows-mouse' approach). Handling the focus
this wait didn't play well with widgets which rely on focus-in-event and
focus-out-event, like the GtkEntry when using a completion popup window, see
e.g:
  https://bugzilla.gnome.org/show_bug.cgi?id=708984

So instead, setup broadway to require a click in a window to move the focus
(i.e. 'click-to-focus' approach):

 * The implicit GDK_FOCUS_CHANGE events that were generated upon reception of
   BROADWAY_EVENT_ENTER or BROADWAY_EVENT_LEAVE are removed.

 * The broadway daemon will now keep track of which is the focused window

 * Whenever the daemon detects an incoming BROADWAY_EVENT_BUTTON_PRESS, it will
   trigger the focused window switch, which sends a new BROADWAY_EVENT_FOCUS to
   the client, specifying which windows holds the focus.

 * Upon reception of a BROADWAY_EVENT_FOCUS, the client will generate a new
   GDK_FOCUS_CHANGE.

 * gdk_broadway_window_focus() was also implemented, which now requests the
   focus to the broadway server using a new BROADWAY_REQUEST_FOCUS_WINDOW.

This is based on an initial patch from Aleksander Morgado <aleksander@lanedo.com>.
2013-11-12 12:03:50 +01:00

74 lines
4.0 KiB
C

#ifndef __GDK_BROADWAY_SERVER__
#define __GDK_BROADWAY_SERVER__
#include <gdk/gdktypes.h>
#include "broadway-protocol.h"
typedef struct _GdkBroadwayServer GdkBroadwayServer;
typedef struct _GdkBroadwayServerClass GdkBroadwayServerClass;
#define GDK_TYPE_BROADWAY_SERVER (gdk_broadway_server_get_type())
#define GDK_BROADWAY_SERVER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_BROADWAY_SERVER, GdkBroadwayServer))
#define GDK_BROADWAY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_BROADWAY_SERVER, GdkBroadwayServerClass))
#define GDK_IS_BROADWAY_SERVER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_BROADWAY_SERVER))
#define GDK_IS_BROADWAY_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_BROADWAY_SERVER))
#define GDK_BROADWAY_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_BROADWAY_SERVER, GdkBroadwayServerClass))
GdkBroadwayServer *_gdk_broadway_server_new (const char *display,
GError **error);
void _gdk_broadway_server_flush (GdkBroadwayServer *server);
void _gdk_broadway_server_sync (GdkBroadwayServer *server);
gulong _gdk_broadway_server_get_next_serial (GdkBroadwayServer *server);
guint32 _gdk_broadway_server_get_last_seen_time (GdkBroadwayServer *server);
gboolean _gdk_broadway_server_lookahead_event (GdkBroadwayServer *server,
const char *types);
void _gdk_broadway_server_query_mouse (GdkBroadwayServer *server,
guint32 *toplevel,
gint32 *root_x,
gint32 *root_y,
guint32 *mask);
GdkGrabStatus _gdk_broadway_server_grab_pointer (GdkBroadwayServer *server,
gint id,
gboolean owner_events,
guint32 event_mask,
guint32 time_);
guint32 _gdk_broadway_server_ungrab_pointer (GdkBroadwayServer *server,
guint32 time_);
gint32 _gdk_broadway_server_get_mouse_toplevel (GdkBroadwayServer *server);
guint32 _gdk_broadway_server_new_window (GdkBroadwayServer *server,
int x,
int y,
int width,
int height,
gboolean is_temp);
void _gdk_broadway_server_destroy_window (GdkBroadwayServer *server,
gint id);
gboolean _gdk_broadway_server_window_show (GdkBroadwayServer *server,
gint id);
gboolean _gdk_broadway_server_window_hide (GdkBroadwayServer *server,
gint id);
void _gdk_broadway_server_window_focus (GdkBroadwayServer *server,
gint id);
void _gdk_broadway_server_window_set_transient_for (GdkBroadwayServer *server,
gint id,
gint parent);
gboolean _gdk_broadway_server_window_translate (GdkBroadwayServer *server,
gint id,
cairo_region_t *area,
gint dx,
gint dy);
cairo_surface_t *_gdk_broadway_server_create_surface (int width,
int height);
void _gdk_broadway_server_window_update (GdkBroadwayServer *server,
gint id,
cairo_surface_t *surface);
gboolean _gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
gint id,
gboolean with_move,
int x,
int y,
int width,
int height);
#endif /* __GDK_BROADWAY_SERVER__ */