2006-02-05 04:04:29 +00:00
|
|
|
/* GDK - The GIMP Drawing Kit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
|
|
|
* file for a list of people on the GTK+ Team.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GTK+ DirectFB backend
|
|
|
|
* Copyright (C) 2001-2002 convergence integrated media GmbH
|
|
|
|
* Copyright (C) 2002-2004 convergence GmbH
|
|
|
|
* Written by Denis Oliver Kropp <dok@convergence.de> and
|
|
|
|
* Sven Neumann <sven@convergence.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "gdk.h"
|
|
|
|
#include "gdkdirectfb.h"
|
|
|
|
#include "gdkprivate-directfb.h"
|
|
|
|
|
|
|
|
#include "gdkinternals.h"
|
|
|
|
|
|
|
|
#include "gdkkeysyms.h"
|
|
|
|
|
|
|
|
#include "gdkinput-directfb.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#ifndef __GDK_X_H__
|
|
|
|
#define __GDK_X_H__
|
|
|
|
gboolean gdk_net_wm_supports (GdkAtom property);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gdkalias.h"
|
|
|
|
|
|
|
|
#define EventBuffer _gdk_display->buffer
|
|
|
|
#define DirectFB _gdk_display->directfb
|
|
|
|
|
|
|
|
#include "gdkaliasdef.c"
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
D_DEBUG_DOMAIN (GDKDFB_Events, "GDKDFB/Events", "GDK DirectFB Events");
|
|
|
|
D_DEBUG_DOMAIN (GDKDFB_MouseEvents, "GDKDFB/Events/Mouse", "GDK DirectFB Mouse Events");
|
|
|
|
D_DEBUG_DOMAIN (GDKDFB_WindowEvents, "GDKDFB/Events/Window", "GDK DirectFB Window Events");
|
|
|
|
D_DEBUG_DOMAIN (GDKDFB_KeyEvents, "GDKDFB/Events/Key", "GDK DirectFB Key Events");
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
/*********************************************
|
|
|
|
* Functions for maintaining the event queue *
|
|
|
|
*********************************************/
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
static gboolean gdk_event_translate (GdkEvent *event,
|
|
|
|
DFBWindowEvent *dfbevent,
|
|
|
|
GdkWindow *window);
|
2006-02-05 04:04:29 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Private variable declarations
|
|
|
|
*/
|
|
|
|
static GList *client_filters; /* Filters for client messages */
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
static gint
|
|
|
|
gdk_event_apply_filters (DFBWindowEvent *dfbevent,
|
|
|
|
GdkEvent *event,
|
|
|
|
GList *filters)
|
2007-12-06 17:45:05 +00:00
|
|
|
{
|
|
|
|
GList *tmp_list;
|
2010-05-14 10:14:08 +00:00
|
|
|
GdkFilterReturn result;
|
2010-08-28 16:38:17 +00:00
|
|
|
|
2007-12-06 17:45:05 +00:00
|
|
|
tmp_list = filters;
|
2010-05-14 10:14:08 +00:00
|
|
|
|
2007-12-06 17:45:05 +00:00
|
|
|
while (tmp_list)
|
|
|
|
{
|
2010-05-14 10:14:08 +00:00
|
|
|
GdkEventFilter *filter = (GdkEventFilter*) tmp_list->data;
|
2010-08-28 16:38:17 +00:00
|
|
|
|
2007-12-06 17:45:05 +00:00
|
|
|
tmp_list = tmp_list->next;
|
|
|
|
result = filter->function (dfbevent, event, filter->data);
|
2010-05-14 10:14:08 +00:00
|
|
|
if (result != GDK_FILTER_CONTINUE)
|
|
|
|
return result;
|
2007-12-06 17:45:05 +00:00
|
|
|
}
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
return GDK_FILTER_CONTINUE;
|
2007-12-06 17:45:05 +00:00
|
|
|
}
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
static void
|
2010-05-14 10:14:08 +00:00
|
|
|
dfb_events_process_window_event (DFBWindowEvent *dfbevent)
|
2006-02-05 04:04:29 +00:00
|
|
|
{
|
2010-05-14 10:14:08 +00:00
|
|
|
GdkDisplay *display = gdk_display_get_default ();
|
|
|
|
GdkWindow *window;
|
|
|
|
GdkEvent *event;
|
|
|
|
GList *node;
|
2007-12-06 17:45:05 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
window = gdk_directfb_window_id_table_lookup (dfbevent->window_id);
|
2007-12-06 17:45:05 +00:00
|
|
|
if (!window)
|
|
|
|
return;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
event = gdk_event_new (GDK_NOTHING);
|
|
|
|
|
|
|
|
event->any.window = NULL;
|
|
|
|
|
|
|
|
((GdkEventPrivate *)event)->flags |= GDK_EVENT_PENDING;
|
|
|
|
|
|
|
|
node = _gdk_event_queue_append (display, event);
|
|
|
|
|
|
|
|
if (gdk_event_translate (event, dfbevent, window))
|
|
|
|
{
|
|
|
|
((GdkEventPrivate *)event)->flags &= ~GDK_EVENT_PENDING;
|
|
|
|
_gdk_windowing_got_event (display, node, event, 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
_gdk_event_queue_remove_link (display, node);
|
|
|
|
g_list_free_1 (node);
|
|
|
|
gdk_event_free (event);
|
|
|
|
}
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gdk_event_send_client_message_by_window (GdkEvent *event,
|
2009-02-18 18:03:51 +00:00
|
|
|
GdkWindow *window)
|
2006-02-05 04:04:29 +00:00
|
|
|
{
|
2009-02-18 18:03:51 +00:00
|
|
|
DFBUserEvent evt;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail(event != NULL, FALSE);
|
|
|
|
g_return_val_if_fail(GDK_IS_WINDOW(window), FALSE);
|
|
|
|
|
2009-02-18 18:03:51 +00:00
|
|
|
evt.clazz = DFEC_USER;
|
|
|
|
evt.type = GPOINTER_TO_UINT (GDK_ATOM_TO_POINTER (event->client.message_type));
|
|
|
|
evt.data = (void *) event->client.data.l[0];
|
|
|
|
|
2010-08-28 16:38:17 +00:00
|
|
|
_gdk_display->buffer->PostEvent (_gdk_display->buffer, DFB_EVENT (&evt));
|
2006-02-05 04:04:29 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
dfb_events_dispatch (void)
|
|
|
|
{
|
|
|
|
GdkDisplay *display = gdk_display_get_default ();
|
|
|
|
GdkEvent *event;
|
|
|
|
|
2009-11-30 05:01:43 +00:00
|
|
|
GDK_THREADS_ENTER ();
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
while ((event = _gdk_event_unqueue (display)) != NULL)
|
|
|
|
{
|
|
|
|
if (_gdk_event_func)
|
|
|
|
(*_gdk_event_func) (event, _gdk_event_data);
|
|
|
|
|
|
|
|
gdk_event_free (event);
|
|
|
|
}
|
2009-11-30 05:01:43 +00:00
|
|
|
|
|
|
|
GDK_THREADS_LEAVE ();
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
dfb_events_io_func (GIOChannel *channel,
|
|
|
|
GIOCondition condition,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gsize i;
|
|
|
|
gsize read;
|
|
|
|
GIOStatus result;
|
|
|
|
DFBEvent buf[23];
|
|
|
|
DFBEvent *event;
|
|
|
|
|
|
|
|
result = g_io_channel_read_chars (channel,
|
|
|
|
(gchar *) buf, sizeof (buf), &read, NULL);
|
|
|
|
|
|
|
|
if (result == G_IO_STATUS_ERROR)
|
|
|
|
{
|
2009-10-21 20:35:12 +00:00
|
|
|
g_warning ("%s: GIOError occured", G_STRFUNC);
|
2006-02-05 04:04:29 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
read /= sizeof (DFBEvent);
|
|
|
|
|
|
|
|
for (i = 0, event = buf; i < read; i++, event++)
|
|
|
|
{
|
|
|
|
switch (event->clazz)
|
|
|
|
{
|
|
|
|
case DFEC_WINDOW:
|
2007-01-20 07:05:55 +00:00
|
|
|
/* TODO workaround to prevent two DWET_ENTER in a row from being delivered */
|
2010-08-28 16:38:17 +00:00
|
|
|
if (event->window.type == DWET_ENTER) {
|
|
|
|
if (i > 0 && buf[i - 1].window.type != DWET_ENTER)
|
2007-01-20 07:05:55 +00:00
|
|
|
dfb_events_process_window_event (&event->window);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
dfb_events_process_window_event (&event->window);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
2009-02-18 18:03:51 +00:00
|
|
|
|
|
|
|
case DFEC_USER:
|
|
|
|
{
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
GDK_NOTE (EVENTS, g_print (" client_message"));
|
|
|
|
|
|
|
|
for (list = client_filters; list; list = list->next)
|
|
|
|
{
|
|
|
|
GdkClientFilter *filter = list->data;
|
|
|
|
DFBUserEvent *user_event = (DFBUserEvent *) event;
|
|
|
|
GdkAtom type;
|
|
|
|
|
|
|
|
type = GDK_POINTER_TO_ATOM (GUINT_TO_POINTER (user_event->type));
|
|
|
|
|
|
|
|
if (filter->type == type)
|
|
|
|
{
|
|
|
|
if (filter->function (user_event,
|
|
|
|
NULL,
|
|
|
|
filter->data) != GDK_FILTER_CONTINUE)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
EventBuffer->Reset (EventBuffer);
|
|
|
|
|
|
|
|
dfb_events_dispatch ();
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_events_init (void)
|
|
|
|
{
|
|
|
|
GIOChannel *channel;
|
|
|
|
GSource *source;
|
|
|
|
DFBResult ret;
|
|
|
|
gint fd;
|
|
|
|
|
|
|
|
ret = DirectFB->CreateEventBuffer (DirectFB, &EventBuffer);
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
DirectFBError ("_gdk_events_init: "
|
|
|
|
"IDirectFB::CreateEventBuffer() failed", ret);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = EventBuffer->CreateFileDescriptor (EventBuffer, &fd);
|
|
|
|
if (ret)
|
|
|
|
{
|
|
|
|
DirectFBError ("_gdk_events_init: "
|
|
|
|
"IDirectFBEventBuffer::CreateFileDescriptor() failed",
|
|
|
|
ret);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
channel = g_io_channel_unix_new (fd);
|
|
|
|
|
|
|
|
g_io_channel_set_encoding (channel, NULL, NULL);
|
|
|
|
g_io_channel_set_buffered (channel, FALSE);
|
|
|
|
|
|
|
|
source = g_io_create_watch (channel, G_IO_IN);
|
|
|
|
|
|
|
|
g_source_set_priority (source, G_PRIORITY_DEFAULT);
|
|
|
|
g_source_set_can_recurse (source, TRUE);
|
|
|
|
g_source_set_callback (source, (GSourceFunc) dfb_events_io_func, NULL, NULL);
|
|
|
|
|
|
|
|
g_source_attach (source, NULL);
|
|
|
|
g_source_unref (source);
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gdk_events_pending (void)
|
|
|
|
{
|
|
|
|
GdkDisplay *display = gdk_display_get_default ();
|
|
|
|
|
|
|
|
return _gdk_event_queue_find_first (display) ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GdkEvent *
|
|
|
|
gdk_event_get_graphics_expose (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkDisplay *display;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
|
|
|
|
|
|
|
|
display = gdk_drawable_get_display (GDK_DRAWABLE (window));
|
|
|
|
|
|
|
|
for (list = _gdk_event_queue_find_first (display); list; list = list->next)
|
|
|
|
{
|
|
|
|
GdkEvent *event = list->data;
|
|
|
|
if (event->type == GDK_EXPOSE && event->expose.window == window)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (list)
|
|
|
|
{
|
|
|
|
GdkEvent *retval = list->data;
|
|
|
|
|
|
|
|
_gdk_event_queue_remove_link (display, list);
|
|
|
|
g_list_free_1 (list);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_events_queue (GdkDisplay *display)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_flush (void)
|
|
|
|
{
|
2010-08-28 16:38:17 +00:00
|
|
|
gdk_display_flush (GDK_DISPLAY_OBJECT (_gdk_display));
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Sends a ClientMessage to all toplevel client windows */
|
|
|
|
gboolean
|
|
|
|
gdk_event_send_client_message_for_display (GdkDisplay *display,
|
|
|
|
GdkEvent *event,
|
|
|
|
guint32 xid)
|
|
|
|
{
|
|
|
|
GdkWindow *win = NULL;
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
|
2010-08-28 16:38:17 +00:00
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
2006-02-05 04:04:29 +00:00
|
|
|
|
|
|
|
win = gdk_window_lookup_for_display (display, (GdkNativeWindow) xid);
|
|
|
|
|
2010-08-28 16:38:17 +00:00
|
|
|
g_return_val_if_fail (win != NULL, FALSE);
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-08-28 16:38:17 +00:00
|
|
|
if ((GDK_WINDOW_OBJECT (win)->window_type != GDK_WINDOW_CHILD) &&
|
2006-02-05 04:04:29 +00:00
|
|
|
(g_object_get_data (G_OBJECT (win), "gdk-window-child-handler")))
|
|
|
|
{
|
|
|
|
/* Managed window, check children */
|
|
|
|
GList *ltmp = NULL;
|
2010-08-28 16:38:17 +00:00
|
|
|
for (ltmp = GDK_WINDOW_OBJECT (win)->children; ltmp; ltmp = ltmp->next)
|
|
|
|
{
|
|
|
|
ret &= gdk_event_send_client_message_by_window (event,
|
|
|
|
GDK_WINDOW(ltmp->data));
|
|
|
|
}
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ret &= gdk_event_send_client_message_by_window (event, win);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****/
|
|
|
|
|
|
|
|
guint32
|
|
|
|
gdk_directfb_get_time (void)
|
|
|
|
{
|
|
|
|
GTimeVal tv;
|
|
|
|
|
|
|
|
g_get_current_time (&tv);
|
|
|
|
|
|
|
|
return (guint32) tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_directfb_event_windows_add (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplDirectFB *impl;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (window)->impl);
|
|
|
|
|
|
|
|
if (!impl->window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (EventBuffer)
|
|
|
|
impl->window->AttachEventBuffer (impl->window, EventBuffer);
|
|
|
|
else
|
|
|
|
impl->window->CreateEventBuffer (impl->window, &EventBuffer);
|
|
|
|
}
|
|
|
|
|
2007-07-12 17:09:02 +00:00
|
|
|
void
|
|
|
|
gdk_directfb_event_windows_remove (GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowImplDirectFB *impl;
|
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_WINDOW (window));
|
|
|
|
|
|
|
|
impl = GDK_WINDOW_IMPL_DIRECTFB (GDK_WINDOW_OBJECT (window)->impl);
|
|
|
|
|
|
|
|
if (!impl->window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (EventBuffer)
|
|
|
|
impl->window->DetachEventBuffer (impl->window, EventBuffer);
|
2010-08-28 16:38:17 +00:00
|
|
|
/* FIXME: should we warn if (! EventBuffer) ? */
|
2007-07-12 17:09:02 +00:00
|
|
|
}
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
GdkWindow *
|
|
|
|
gdk_directfb_child_at (GdkWindow *window,
|
|
|
|
gint *winx,
|
|
|
|
gint *winy)
|
|
|
|
{
|
|
|
|
GdkWindowObject *private;
|
|
|
|
GList *list;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
|
|
|
|
|
|
|
|
private = GDK_WINDOW_OBJECT (window);
|
|
|
|
for (list = private->children; list; list = list->next)
|
|
|
|
{
|
|
|
|
GdkWindowObject *win = list->data;
|
|
|
|
|
|
|
|
if (GDK_WINDOW_IS_MAPPED (win) &&
|
|
|
|
*winx >= win->x &&
|
|
|
|
*winx < win->x + GDK_DRAWABLE_IMPL_DIRECTFB (win->impl)->width &&
|
|
|
|
*winy >= win->y &&
|
|
|
|
*winy < win->y + GDK_DRAWABLE_IMPL_DIRECTFB (win->impl)->height)
|
|
|
|
{
|
|
|
|
*winx -= win->x;
|
|
|
|
*winy -= win->y;
|
|
|
|
|
2010-08-28 16:38:17 +00:00
|
|
|
return gdk_directfb_child_at (GDK_WINDOW (win), winx, winy);
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return window;
|
|
|
|
}
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_event_translate (GdkEvent *event,
|
|
|
|
DFBWindowEvent *dfbevent,
|
2006-02-05 04:04:29 +00:00
|
|
|
GdkWindow *window)
|
|
|
|
{
|
|
|
|
GdkWindowObject *private;
|
|
|
|
GdkDisplay *display;
|
2010-05-14 10:14:08 +00:00
|
|
|
/* GdkEvent *event = NULL; */
|
|
|
|
gboolean return_val = FALSE;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (dfbevent != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (window), FALSE);
|
|
|
|
|
|
|
|
D_DEBUG_AT (GDKDFB_Events, "%s( %p, %p, %p )\n", G_STRFUNC,
|
|
|
|
event, dfbevent, window);
|
2006-02-05 04:04:29 +00:00
|
|
|
|
|
|
|
private = GDK_WINDOW_OBJECT (window);
|
|
|
|
|
|
|
|
g_object_ref (G_OBJECT (window));
|
2007-12-06 17:45:05 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
event->any.window = NULL;
|
|
|
|
event->any.send_event = FALSE;
|
|
|
|
|
2007-12-06 17:45:05 +00:00
|
|
|
/*
|
2010-05-14 10:14:08 +00:00
|
|
|
* Apply global filters
|
2007-12-06 17:45:05 +00:00
|
|
|
*
|
|
|
|
* If result is GDK_FILTER_CONTINUE, we continue as if nothing
|
|
|
|
* happened. If it is GDK_FILTER_REMOVE or GDK_FILTER_TRANSLATE,
|
|
|
|
* we return TRUE and won't dispatch the event.
|
|
|
|
*/
|
2010-05-14 10:14:08 +00:00
|
|
|
if (_gdk_default_filters)
|
2007-12-06 17:45:05 +00:00
|
|
|
{
|
2010-05-14 10:14:08 +00:00
|
|
|
GdkFilterReturn result;
|
|
|
|
result = gdk_event_apply_filters (dfbevent, event, _gdk_default_filters);
|
2007-12-06 17:45:05 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
if (result != GDK_FILTER_CONTINUE)
|
|
|
|
{
|
|
|
|
return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
|
|
|
|
goto done;
|
2007-12-06 17:45:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Apply per-window filters */
|
|
|
|
if (GDK_IS_WINDOW (window))
|
|
|
|
{
|
|
|
|
GdkFilterReturn result;
|
|
|
|
|
|
|
|
if (private->filters)
|
|
|
|
{
|
|
|
|
result = gdk_event_apply_filters (dfbevent, event, private->filters);
|
|
|
|
|
|
|
|
if (result != GDK_FILTER_CONTINUE)
|
|
|
|
{
|
|
|
|
return_val = (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
display = gdk_drawable_get_display (GDK_DRAWABLE (window));
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
return_val = TRUE;
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
switch (dfbevent->type)
|
|
|
|
{
|
|
|
|
case DWET_BUTTONDOWN:
|
|
|
|
case DWET_BUTTONUP:
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Backend store */
|
|
|
|
_gdk_directfb_mouse_x = dfbevent->cx;
|
|
|
|
_gdk_directfb_mouse_y = dfbevent->cy;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Event translation */
|
|
|
|
gdk_directfb_event_fill (event, window,
|
|
|
|
dfbevent->type == DWET_BUTTONDOWN ?
|
|
|
|
GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
|
|
|
|
switch (dfbevent->button)
|
|
|
|
{
|
|
|
|
case DIBI_LEFT:
|
|
|
|
event->button.button = 1;
|
|
|
|
break;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
case DIBI_MIDDLE:
|
|
|
|
event->button.button = 2;
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
case DIBI_RIGHT:
|
|
|
|
event->button.button = 3;
|
|
|
|
break;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
default:
|
|
|
|
event->button.button = dfbevent->button + 1;
|
|
|
|
break;
|
|
|
|
}
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
event->button.window = window;
|
|
|
|
event->button.x_root = dfbevent->cx;
|
|
|
|
event->button.y_root = dfbevent->cy;
|
|
|
|
event->button.x = dfbevent->x;
|
|
|
|
event->button.y = dfbevent->y;
|
|
|
|
event->button.state = _gdk_directfb_modifiers;
|
|
|
|
event->button.device = display->core_pointer;
|
|
|
|
gdk_event_set_screen (event, _gdk_screen);
|
|
|
|
|
|
|
|
D_DEBUG_AT (GDKDFB_MouseEvents, " -> %s at %ix%i\n",
|
|
|
|
event->type == GDK_BUTTON_PRESS ? "buttonpress" : "buttonrelease",
|
|
|
|
(gint) event->button.x, (gint) event->button.y);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_MOTION:
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Backend store */
|
|
|
|
_gdk_directfb_mouse_x = dfbevent->cx;
|
|
|
|
_gdk_directfb_mouse_y = dfbevent->cy;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Event translation */
|
|
|
|
gdk_directfb_event_fill (event, window, GDK_MOTION_NOTIFY);
|
|
|
|
event->motion.x_root = dfbevent->cx;
|
|
|
|
event->motion.y_root = dfbevent->cy;
|
|
|
|
event->motion.x = dfbevent->x;
|
|
|
|
event->motion.y = dfbevent->y;
|
|
|
|
event->motion.axes = NULL;
|
|
|
|
event->motion.state = _gdk_directfb_modifiers;
|
|
|
|
event->motion.is_hint = FALSE;
|
|
|
|
event->motion.device = display->core_pointer;
|
|
|
|
gdk_event_set_screen (event, _gdk_screen);
|
|
|
|
|
|
|
|
D_DEBUG_AT (GDKDFB_MouseEvents, " -> move pointer to %ix%i\n",
|
|
|
|
(gint) event->button.x, (gint) event->button.y);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_GOTFOCUS:
|
2010-05-14 10:14:08 +00:00
|
|
|
gdk_directfb_event_fill (event, window, GDK_FOCUS_CHANGE);
|
|
|
|
event->focus_change.window = window;
|
|
|
|
event->focus_change.in = TRUE;
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_LOSTFOCUS:
|
2010-05-14 10:14:08 +00:00
|
|
|
gdk_directfb_event_fill (event, window, GDK_FOCUS_CHANGE);
|
|
|
|
event->focus_change.window = window;
|
|
|
|
event->focus_change.in = FALSE;
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_POSITION:
|
2010-05-14 10:14:08 +00:00
|
|
|
gdk_directfb_event_fill (event, window, GDK_CONFIGURE);
|
|
|
|
event->configure.x = dfbevent->x;
|
|
|
|
event->configure.y = dfbevent->y;
|
|
|
|
event->configure.width = private->width;
|
|
|
|
event->configure.height = private->height;
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_POSITION_SIZE:
|
2010-05-14 10:14:08 +00:00
|
|
|
event->configure.x = dfbevent->x;
|
|
|
|
event->configure.y = dfbevent->y;
|
2006-02-05 04:04:29 +00:00
|
|
|
/* fallthru */
|
|
|
|
|
|
|
|
case DWET_SIZE:
|
2010-05-14 10:14:08 +00:00
|
|
|
gdk_directfb_event_fill (event, window, GDK_CONFIGURE);
|
|
|
|
event->configure.window = window;
|
|
|
|
event->configure.width = dfbevent->w;
|
|
|
|
event->configure.height = dfbevent->h;
|
|
|
|
|
|
|
|
D_DEBUG_AT (GDKDFB_WindowEvents,
|
|
|
|
" -> configure window %p at %ix%i-%ix%i\n",
|
|
|
|
window, event->configure.x, event->configure.y,
|
|
|
|
event->configure.width, event->configure.height);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_KEYDOWN:
|
|
|
|
case DWET_KEYUP:
|
2010-05-14 10:14:08 +00:00
|
|
|
gdk_directfb_event_fill (event, window,
|
|
|
|
dfbevent->type == DWET_KEYUP ?
|
|
|
|
GDK_KEY_RELEASE : GDK_KEY_PRESS);
|
|
|
|
event->key.window = window;
|
|
|
|
gdk_directfb_translate_key_event (dfbevent, (GdkEventKey *) event);
|
|
|
|
|
|
|
|
D_DEBUG_AT (GDKDFB_KeyEvents, " -> key window=%p val=%x code=%x str=%s\n",
|
|
|
|
window, event->key.keyval, event->key.hardware_keycode,
|
|
|
|
event->key.string);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
case DWET_ENTER:
|
2006-02-05 04:04:29 +00:00
|
|
|
case DWET_LEAVE:
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Backend store */
|
2006-02-05 04:04:29 +00:00
|
|
|
_gdk_directfb_mouse_x = dfbevent->cx;
|
|
|
|
_gdk_directfb_mouse_y = dfbevent->cy;
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Event translation */
|
|
|
|
gdk_directfb_event_fill (event, window,
|
|
|
|
dfbevent->type == DWET_ENTER ?
|
|
|
|
GDK_ENTER_NOTIFY : GDK_LEAVE_NOTIFY);
|
|
|
|
event->crossing.window = g_object_ref (window);
|
|
|
|
event->crossing.subwindow = NULL;
|
|
|
|
event->crossing.time = GDK_CURRENT_TIME;
|
|
|
|
event->crossing.x = dfbevent->x;
|
|
|
|
event->crossing.y = dfbevent->y;
|
|
|
|
event->crossing.x_root = dfbevent->cx;
|
|
|
|
event->crossing.y_root = dfbevent->cy;
|
|
|
|
event->crossing.mode = GDK_CROSSING_NORMAL;
|
|
|
|
event->crossing.detail = GDK_NOTIFY_ANCESTOR;
|
|
|
|
event->crossing.state = 0;
|
|
|
|
|
|
|
|
/**/
|
2006-02-05 04:04:29 +00:00
|
|
|
if (gdk_directfb_apply_focus_opacity)
|
|
|
|
{
|
2010-05-14 10:14:08 +00:00
|
|
|
if (dfbevent->type == DWET_ENTER)
|
|
|
|
{
|
|
|
|
if (GDK_WINDOW_IS_MAPPED (window))
|
|
|
|
GDK_WINDOW_IMPL_DIRECTFB (private->impl)->window->SetOpacity
|
|
|
|
(GDK_WINDOW_IMPL_DIRECTFB (private->impl)->window,
|
|
|
|
(GDK_WINDOW_IMPL_DIRECTFB (private->impl)->opacity >> 1) +
|
|
|
|
(GDK_WINDOW_IMPL_DIRECTFB (private->impl)->opacity >> 2));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
GDK_WINDOW_IMPL_DIRECTFB (private->impl)->window->SetOpacity
|
|
|
|
(GDK_WINDOW_IMPL_DIRECTFB (private->impl)->window,
|
|
|
|
GDK_WINDOW_IMPL_DIRECTFB (private->impl)->opacity);
|
|
|
|
}
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
D_DEBUG_AT (GDKDFB_WindowEvents, " -> %s window %p at relative=%ix%i absolute=%ix%i\n",
|
|
|
|
dfbevent->type == DWET_ENTER ? "enter" : "leave",
|
|
|
|
window, (gint) event->crossing.x, (gint) event->crossing.y,
|
|
|
|
(gint) event->crossing.x_root, (gint) event->crossing.y_root);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_CLOSE:
|
2010-05-14 10:14:08 +00:00
|
|
|
gdk_directfb_event_fill (event, window, GDK_DELETE);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_DESTROYED:
|
2010-05-14 10:14:08 +00:00
|
|
|
gdk_directfb_event_fill (event, window, GDK_DESTROY);
|
|
|
|
gdk_window_destroy_notify (window);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case DWET_WHEEL:
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Backend store */
|
|
|
|
_gdk_directfb_mouse_x = dfbevent->cx;
|
|
|
|
_gdk_directfb_mouse_y = dfbevent->cy;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
/* Event translation */
|
|
|
|
gdk_directfb_event_fill (event, window, GDK_SCROLL);
|
|
|
|
event->scroll.direction = (dfbevent->step > 0 ?
|
|
|
|
GDK_SCROLL_UP : GDK_SCROLL_DOWN);
|
|
|
|
event->scroll.x_root = dfbevent->cx;
|
|
|
|
event->scroll.y_root = dfbevent->cy;
|
|
|
|
event->scroll.x = dfbevent->x;
|
|
|
|
event->scroll.y = dfbevent->y;
|
|
|
|
event->scroll.state = _gdk_directfb_modifiers;
|
|
|
|
event->scroll.device = display->core_pointer;
|
|
|
|
|
|
|
|
D_DEBUG_AT (GDKDFB_MouseEvents, " -> mouse scroll %s at %ix%i\n",
|
|
|
|
event->scroll.direction == GDK_SCROLL_UP ? "up" : "down",
|
|
|
|
(gint) event->scroll.x, (gint) event->scroll.y);
|
2006-02-05 04:04:29 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_message ("unhandled DirectFB windowing event 0x%08x", dfbevent->type);
|
|
|
|
}
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
done:
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
g_object_unref (G_OBJECT (window));
|
|
|
|
|
2010-05-14 10:14:08 +00:00
|
|
|
return return_val;
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gdk_screen_get_setting (GdkScreen *screen,
|
|
|
|
const gchar *name,
|
|
|
|
GValue *value)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_display_add_client_message_filter (GdkDisplay *display,
|
|
|
|
GdkAtom message_type,
|
|
|
|
GdkFilterFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
/* XXX: display should be used */
|
|
|
|
GdkClientFilter *filter = g_new (GdkClientFilter, 1);
|
|
|
|
|
|
|
|
filter->type = message_type;
|
|
|
|
filter->function = func;
|
|
|
|
filter->data = data;
|
|
|
|
client_filters = g_list_append (client_filters, filter);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_add_client_message_filter (GdkAtom message_type,
|
|
|
|
GdkFilterFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
gdk_display_add_client_message_filter (gdk_display_get_default (),
|
|
|
|
message_type, func, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gdk_screen_broadcast_client_message (GdkScreen *screen,
|
|
|
|
GdkEvent *sev)
|
|
|
|
{
|
2010-08-28 16:38:17 +00:00
|
|
|
GdkWindow *root_window;
|
2006-02-05 04:04:29 +00:00
|
|
|
GdkWindowObject *private;
|
2010-08-28 16:38:17 +00:00
|
|
|
GList *top_level = NULL;
|
2006-02-05 04:04:29 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GDK_IS_SCREEN (screen));
|
2010-08-28 16:38:17 +00:00
|
|
|
g_return_if_fail (sev != NULL);
|
2006-02-05 04:04:29 +00:00
|
|
|
|
|
|
|
root_window = gdk_screen_get_root_window (screen);
|
|
|
|
|
2010-08-28 16:38:17 +00:00
|
|
|
g_return_if_fail (GDK_IS_WINDOW (root_window));
|
2006-02-05 04:04:29 +00:00
|
|
|
|
|
|
|
private = GDK_WINDOW_OBJECT (root_window);
|
|
|
|
|
|
|
|
for (top_level = private->children; top_level; top_level = top_level->next)
|
|
|
|
{
|
2010-08-28 16:38:17 +00:00
|
|
|
gdk_event_send_client_message_for_display (gdk_drawable_get_display (GDK_DRAWABLE (root_window)),
|
|
|
|
sev,
|
|
|
|
(guint32)(GDK_WINDOW_DFB_ID (GDK_WINDOW (top_level->data))));
|
|
|
|
}
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gdk_net_wm_supports:
|
|
|
|
* @property: a property atom.
|
|
|
|
*
|
|
|
|
* This function is specific to the X11 backend of GDK, and indicates
|
|
|
|
* whether the window manager for the default screen supports a certain
|
|
|
|
* hint from the Extended Window Manager Hints Specification. See
|
|
|
|
* gdk_x11_screen_supports_net_wm_hint() for complete details.
|
|
|
|
*
|
|
|
|
* Return value: %TRUE if the window manager supports @property
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gdk_net_wm_supports (GdkAtom property)
|
|
|
|
{
|
2010-08-28 16:38:17 +00:00
|
|
|
return FALSE;
|
2006-02-05 04:04:29 +00:00
|
|
|
}
|
|
|
|
|
2008-05-06 21:00:06 +00:00
|
|
|
void
|
2008-05-06 22:35:13 +00:00
|
|
|
_gdk_windowing_event_data_copy (const GdkEvent *src,
|
|
|
|
GdkEvent *dst)
|
2008-05-06 21:00:06 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
_gdk_windowing_event_data_free (GdkEvent *event)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-02-05 04:04:29 +00:00
|
|
|
#define __GDK_EVENTS_X11_C__
|
|
|
|
#include "gdkaliasdef.c"
|