2008-07-01 22:57:50 +00:00
|
|
|
|
/* GDK - The GIMP Drawing Kit
|
1998-12-15 13:54:20 +00:00
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-12-15 13:54:20 +00:00
|
|
|
|
* 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
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
1998-12-15 13:54:20 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
1998-12-15 13:54:20 +00:00
|
|
|
|
*/
|
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2002-10-03 20:53:30 +00:00
|
|
|
|
|
2017-10-25 13:46:47 +00:00
|
|
|
|
#include "gdkintl.h"
|
2017-08-05 13:34:39 +00:00
|
|
|
|
#include "gdkeventsprivate.h"
|
2000-03-28 01:24:44 +00:00
|
|
|
|
#include "gdkinternals.h"
|
2010-12-11 05:14:53 +00:00
|
|
|
|
#include "gdkdisplayprivate.h"
|
2016-01-08 20:22:47 +00:00
|
|
|
|
#include "gdkdndprivate.h"
|
2017-08-16 08:37:17 +00:00
|
|
|
|
#include "gdk-private.h"
|
2010-07-09 00:34:45 +00:00
|
|
|
|
|
2010-10-15 02:05:51 +00:00
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <math.h>
|
1998-12-24 19:39:00 +00:00
|
|
|
|
|
2010-11-15 18:15:00 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* SECTION:events
|
|
|
|
|
* @Short_description: Functions for handling events from the window system
|
|
|
|
|
* @Title: Events
|
2014-02-07 02:07:03 +00:00
|
|
|
|
* @See_also: [Event Structures][gdk3-Event-Structures]
|
2010-11-15 18:15:00 +00:00
|
|
|
|
*
|
|
|
|
|
* This section describes functions dealing with events from the window
|
|
|
|
|
* system.
|
|
|
|
|
*
|
|
|
|
|
* In GTK+ applications the events are handled automatically in
|
2017-12-26 15:22:21 +00:00
|
|
|
|
* gtk_main_do_event() and passed on to the appropriate widgets,
|
|
|
|
|
* so these functions are rarely needed.
|
2010-11-15 18:15:00 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2017-12-26 19:39:24 +00:00
|
|
|
|
/**
|
|
|
|
|
* GdkEvent:
|
|
|
|
|
*
|
|
|
|
|
* The GdkEvent struct contains only private fields and
|
|
|
|
|
* should not be accessed directly.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GdkEventSequence:
|
|
|
|
|
*
|
|
|
|
|
* GdkEventSequence is an opaque type representing a sequence
|
|
|
|
|
* of related touch events.
|
|
|
|
|
*/
|
2010-11-15 18:15:00 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
typedef struct _GdkIOClosure GdkIOClosure;
|
1999-01-12 23:27:30 +00:00
|
|
|
|
|
1999-02-10 08:06:30 +00:00
|
|
|
|
struct _GdkIOClosure
|
|
|
|
|
{
|
2008-06-18 09:39:24 +00:00
|
|
|
|
GDestroyNotify notify;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
gpointer data;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Private variable declarations
|
|
|
|
|
*/
|
|
|
|
|
|
2010-12-02 09:59:37 +00:00
|
|
|
|
static GdkEventFunc _gdk_event_func = NULL; /* Callback for events */
|
|
|
|
|
static gpointer _gdk_event_data = NULL;
|
|
|
|
|
static GDestroyNotify _gdk_event_notify = NULL;
|
|
|
|
|
|
2017-10-25 11:23:41 +00:00
|
|
|
|
static GQuark quark_event_user_data = 0;
|
|
|
|
|
|
2017-10-25 13:49:19 +00:00
|
|
|
|
static void gdk_event_constructed (GObject *object);
|
2017-10-25 11:23:41 +00:00
|
|
|
|
static void gdk_event_finalize (GObject *object);
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (GdkEvent, gdk_event, G_TYPE_OBJECT)
|
|
|
|
|
|
2017-10-25 13:46:47 +00:00
|
|
|
|
enum {
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_EVENT_TYPE,
|
|
|
|
|
N_PROPS
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static GParamSpec *event_props[N_PROPS] = { NULL, };
|
|
|
|
|
|
2017-10-25 11:23:41 +00:00
|
|
|
|
#define EVENT_PAYLOAD(ev) (&(ev)->any.type)
|
|
|
|
|
#define EVENT_PAYLOAD_SIZE (sizeof (GdkEvent) - sizeof (GObject))
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_event_init (GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-25 13:46:47 +00:00
|
|
|
|
static void
|
|
|
|
|
gdk_event_real_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GdkEvent *event = GDK_EVENT (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_EVENT_TYPE:
|
|
|
|
|
g_value_set_enum (value, event->any.type);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_event_real_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
|
|
|
|
{
|
|
|
|
|
GdkEvent *event = GDK_EVENT (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case PROP_EVENT_TYPE:
|
|
|
|
|
event->any.type = g_value_get_enum (value);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-25 11:23:41 +00:00
|
|
|
|
static void
|
|
|
|
|
gdk_event_class_init (GdkEventClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
2017-10-25 13:46:47 +00:00
|
|
|
|
object_class->get_property = gdk_event_real_get_property;
|
|
|
|
|
object_class->set_property = gdk_event_real_set_property;
|
2017-10-25 13:49:19 +00:00
|
|
|
|
object_class->constructed = gdk_event_constructed;
|
2017-10-25 11:23:41 +00:00
|
|
|
|
object_class->finalize = gdk_event_finalize;
|
|
|
|
|
|
2017-10-25 13:46:47 +00:00
|
|
|
|
event_props[PROP_EVENT_TYPE] =
|
|
|
|
|
g_param_spec_enum ("event-type",
|
|
|
|
|
P_("Event type"),
|
|
|
|
|
P_("Event type"),
|
|
|
|
|
GDK_TYPE_EVENT_TYPE, GDK_NOTHING,
|
|
|
|
|
G_PARAM_READWRITE |
|
|
|
|
|
G_PARAM_CONSTRUCT_ONLY);
|
|
|
|
|
g_object_class_install_properties (object_class, N_PROPS, event_props);
|
|
|
|
|
|
2017-10-25 11:23:41 +00:00
|
|
|
|
quark_event_user_data = g_quark_from_static_string ("gdk-event-user-data");
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-02 09:59:37 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_event_emit (GdkEvent *event)
|
|
|
|
|
{
|
2016-01-08 20:22:47 +00:00
|
|
|
|
if (gdk_drag_context_handle_source_event (event))
|
|
|
|
|
return;
|
|
|
|
|
|
2010-12-02 09:59:37 +00:00
|
|
|
|
if (_gdk_event_func)
|
|
|
|
|
(*_gdk_event_func) (event, _gdk_event_data);
|
2016-03-09 16:00:31 +00:00
|
|
|
|
|
|
|
|
|
if (gdk_drag_context_handle_dest_event (event))
|
|
|
|
|
return;
|
2010-12-02 09:59:37 +00:00
|
|
|
|
}
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
1999-01-12 23:27:30 +00:00
|
|
|
|
/*********************************************
|
|
|
|
|
* Functions for maintaining the event queue *
|
|
|
|
|
*********************************************/
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
* _gdk_event_queue_find_first:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* @display: a #GdkDisplay
|
|
|
|
|
*
|
|
|
|
|
* Find the first event on the queue that is not still
|
|
|
|
|
* being filled in.
|
|
|
|
|
*
|
2014-05-08 19:55:50 +00:00
|
|
|
|
* Returns: (nullable): Pointer to the list node for that event, or
|
|
|
|
|
* %NULL.
|
2002-04-25 22:29:14 +00:00
|
|
|
|
**/
|
1999-11-08 20:14:59 +00:00
|
|
|
|
GList*
|
2002-04-25 22:29:14 +00:00
|
|
|
|
_gdk_event_queue_find_first (GdkDisplay *display)
|
1999-01-12 23:27:30 +00:00
|
|
|
|
{
|
2012-09-26 14:28:06 +00:00
|
|
|
|
GList *tmp_list;
|
|
|
|
|
GList *pending_motion = NULL;
|
|
|
|
|
|
2013-11-11 23:04:34 +00:00
|
|
|
|
gboolean paused = display->event_pause_count > 0;
|
1999-01-12 23:27:30 +00:00
|
|
|
|
|
2012-09-26 14:28:06 +00:00
|
|
|
|
tmp_list = display->queued_events;
|
1999-01-12 23:27:30 +00:00
|
|
|
|
while (tmp_list)
|
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
GdkEvent *event = tmp_list->data;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if ((event->any.flags & GDK_EVENT_PENDING) == 0 &&
|
|
|
|
|
(!paused || (event->any.flags & GDK_EVENT_FLUSHED) != 0))
|
2013-09-28 16:06:53 +00:00
|
|
|
|
{
|
|
|
|
|
if (pending_motion)
|
|
|
|
|
return pending_motion;
|
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (event->any.type == GDK_MOTION_NOTIFY && (event->any.flags & GDK_EVENT_FLUSHED) == 0)
|
2013-09-28 16:06:53 +00:00
|
|
|
|
pending_motion = tmp_list;
|
|
|
|
|
else
|
|
|
|
|
return tmp_list;
|
|
|
|
|
}
|
1999-01-21 06:24:09 +00:00
|
|
|
|
|
2015-10-20 00:28:06 +00:00
|
|
|
|
tmp_list = tmp_list->next;
|
1999-01-12 23:27:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* _gdk_event_queue_append:
|
|
|
|
|
* @display: a #GdkDisplay
|
|
|
|
|
* @event: Event to append.
|
|
|
|
|
*
|
|
|
|
|
* Appends an event onto the tail of the event queue.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the newly appended list node.
|
|
|
|
|
**/
|
|
|
|
|
GList *
|
|
|
|
|
_gdk_event_queue_append (GdkDisplay *display,
|
|
|
|
|
GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
display->queued_tail = g_list_append (display->queued_tail, event);
|
|
|
|
|
|
|
|
|
|
if (!display->queued_events)
|
|
|
|
|
display->queued_events = display->queued_tail;
|
|
|
|
|
else
|
|
|
|
|
display->queued_tail = display->queued_tail->next;
|
|
|
|
|
|
|
|
|
|
return display->queued_tail;
|
|
|
|
|
}
|
1999-01-12 23:27:30 +00:00
|
|
|
|
|
2008-07-18 13:03:42 +00:00
|
|
|
|
/**
|
|
|
|
|
* _gdk_event_queue_insert_after:
|
|
|
|
|
* @display: a #GdkDisplay
|
|
|
|
|
* @sibling: Append after this event.
|
|
|
|
|
* @event: Event to append.
|
|
|
|
|
*
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* Appends an event after the specified event, or if it isn’t in
|
2008-07-18 13:03:42 +00:00
|
|
|
|
* the queue, onto the tail of the event queue.
|
|
|
|
|
*
|
|
|
|
|
* Returns: the newly appended list node.
|
|
|
|
|
*/
|
|
|
|
|
GList*
|
|
|
|
|
_gdk_event_queue_insert_after (GdkDisplay *display,
|
|
|
|
|
GdkEvent *sibling,
|
|
|
|
|
GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GList *prev = g_list_find (display->queued_events, sibling);
|
|
|
|
|
if (prev && prev->next)
|
|
|
|
|
{
|
|
|
|
|
display->queued_events = g_list_insert_before (display->queued_events, prev->next, event);
|
|
|
|
|
return prev->next;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return _gdk_event_queue_append (display, event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2012-04-13 00:07:28 +00:00
|
|
|
|
* _gdk_event_queue_insert_before:
|
2008-07-18 13:03:42 +00:00
|
|
|
|
* @display: a #GdkDisplay
|
2012-04-13 00:07:28 +00:00
|
|
|
|
* @sibling: Append before this event
|
|
|
|
|
* @event: Event to prepend
|
2008-07-18 13:03:42 +00:00
|
|
|
|
*
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* Prepends an event before the specified event, or if it isn’t in
|
2012-04-13 00:07:28 +00:00
|
|
|
|
* the queue, onto the head of the event queue.
|
2008-07-18 13:03:42 +00:00
|
|
|
|
*
|
2012-04-13 00:07:28 +00:00
|
|
|
|
* Returns: the newly prepended list node.
|
2008-07-18 13:03:42 +00:00
|
|
|
|
*/
|
|
|
|
|
GList*
|
|
|
|
|
_gdk_event_queue_insert_before (GdkDisplay *display,
|
|
|
|
|
GdkEvent *sibling,
|
|
|
|
|
GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GList *next = g_list_find (display->queued_events, sibling);
|
|
|
|
|
if (next)
|
|
|
|
|
{
|
|
|
|
|
display->queued_events = g_list_insert_before (display->queued_events, next, event);
|
|
|
|
|
return next->prev;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return _gdk_event_queue_append (display, event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* _gdk_event_queue_remove_link:
|
|
|
|
|
* @display: a #GdkDisplay
|
|
|
|
|
* @node: node to remove
|
|
|
|
|
*
|
|
|
|
|
* Removes a specified list node from the event queue.
|
|
|
|
|
**/
|
1999-11-08 20:14:59 +00:00
|
|
|
|
void
|
2002-04-25 22:29:14 +00:00
|
|
|
|
_gdk_event_queue_remove_link (GdkDisplay *display,
|
|
|
|
|
GList *node)
|
1999-01-12 23:27:30 +00:00
|
|
|
|
{
|
|
|
|
|
if (node->prev)
|
|
|
|
|
node->prev->next = node->next;
|
|
|
|
|
else
|
2002-04-25 22:29:14 +00:00
|
|
|
|
display->queued_events = node->next;
|
1999-01-12 23:27:30 +00:00
|
|
|
|
|
|
|
|
|
if (node->next)
|
|
|
|
|
node->next->prev = node->prev;
|
|
|
|
|
else
|
2002-04-25 22:29:14 +00:00
|
|
|
|
display->queued_tail = node->prev;
|
1999-01-12 23:27:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* _gdk_event_unqueue:
|
|
|
|
|
* @display: a #GdkDisplay
|
|
|
|
|
*
|
|
|
|
|
* Removes and returns the first event from the event
|
|
|
|
|
* queue that is not still being filled in.
|
|
|
|
|
*
|
2014-05-08 19:55:50 +00:00
|
|
|
|
* Returns: (nullable): the event, or %NULL. Ownership is transferred
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* to the caller.
|
|
|
|
|
**/
|
|
|
|
|
GdkEvent*
|
|
|
|
|
_gdk_event_unqueue (GdkDisplay *display)
|
1999-01-12 23:27:30 +00:00
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
GdkEvent *event = NULL;
|
|
|
|
|
GList *tmp_list;
|
|
|
|
|
|
|
|
|
|
tmp_list = _gdk_event_queue_find_first (display);
|
|
|
|
|
|
|
|
|
|
if (tmp_list)
|
|
|
|
|
{
|
|
|
|
|
event = tmp_list->data;
|
|
|
|
|
_gdk_event_queue_remove_link (display, tmp_list);
|
|
|
|
|
g_list_free_1 (tmp_list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return event;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-31 11:37:50 +00:00
|
|
|
|
static void
|
|
|
|
|
gdk_event_push_history (GdkEvent *event,
|
|
|
|
|
const GdkEvent *history_event)
|
|
|
|
|
{
|
|
|
|
|
GdkTimeCoord *hist;
|
|
|
|
|
GdkDevice *device;
|
|
|
|
|
gint i, n_axes;
|
|
|
|
|
|
|
|
|
|
g_assert (event->any.type == GDK_MOTION_NOTIFY);
|
|
|
|
|
g_assert (history_event->any.type == GDK_MOTION_NOTIFY);
|
|
|
|
|
|
|
|
|
|
hist = g_new0 (GdkTimeCoord, 1);
|
|
|
|
|
|
|
|
|
|
device = gdk_event_get_device (history_event);
|
|
|
|
|
n_axes = gdk_device_get_n_axes (device);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i <= MIN (n_axes, GDK_MAX_TIMECOORD_AXES); i++)
|
|
|
|
|
gdk_event_get_axis (history_event, i, &hist->axes[i]);
|
|
|
|
|
|
|
|
|
|
event->motion.history = g_list_prepend (event->motion.history, hist);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-26 14:28:06 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_event_queue_handle_motion_compression (GdkDisplay *display)
|
|
|
|
|
{
|
|
|
|
|
GList *tmp_list;
|
|
|
|
|
GList *pending_motions = NULL;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *pending_motion_surface = NULL;
|
2013-02-14 19:51:33 +00:00
|
|
|
|
GdkDevice *pending_motion_device = NULL;
|
2017-10-31 11:37:50 +00:00
|
|
|
|
GdkEvent *last_motion = NULL;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
|
|
|
|
/* If the last N events in the event queue are motion notify
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* events for the same surface, drop all but the last */
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
|
|
|
|
tmp_list = display->queued_tail;
|
|
|
|
|
|
|
|
|
|
while (tmp_list)
|
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
GdkEvent *event = tmp_list->data;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (event->any.flags & GDK_EVENT_PENDING)
|
2012-09-26 14:28:06 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (event->any.type != GDK_MOTION_NOTIFY)
|
2012-09-26 14:28:06 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (pending_motion_surface != NULL &&
|
|
|
|
|
pending_motion_surface != event->any.surface)
|
2012-09-26 14:28:06 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2013-02-14 19:51:33 +00:00
|
|
|
|
if (pending_motion_device != NULL &&
|
2017-10-11 06:42:41 +00:00
|
|
|
|
pending_motion_device != event->any.device)
|
2013-02-14 19:51:33 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2017-10-31 11:37:50 +00:00
|
|
|
|
if (!last_motion)
|
|
|
|
|
last_motion = event;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
pending_motion_surface = event->any.surface;
|
2017-10-11 06:42:41 +00:00
|
|
|
|
pending_motion_device = event->any.device;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
pending_motions = tmp_list;
|
|
|
|
|
|
|
|
|
|
tmp_list = tmp_list->prev;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (pending_motions && pending_motions->next != NULL)
|
|
|
|
|
{
|
|
|
|
|
GList *next = pending_motions->next;
|
2017-10-31 11:37:50 +00:00
|
|
|
|
|
|
|
|
|
if (last_motion &&
|
|
|
|
|
(last_motion->motion.state &
|
|
|
|
|
(GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK |
|
|
|
|
|
GDK_BUTTON4_MASK | GDK_BUTTON5_MASK)))
|
|
|
|
|
gdk_event_push_history (last_motion, pending_motions->data);
|
|
|
|
|
|
2016-05-01 18:05:56 +00:00
|
|
|
|
gdk_event_free (pending_motions->data);
|
2012-09-26 14:28:06 +00:00
|
|
|
|
display->queued_events = g_list_delete_link (display->queued_events,
|
|
|
|
|
pending_motions);
|
|
|
|
|
pending_motions = next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pending_motions &&
|
|
|
|
|
pending_motions == display->queued_events &&
|
|
|
|
|
pending_motions == display->queued_tail)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkFrameClock *clock = gdk_surface_get_frame_clock (pending_motion_surface);
|
|
|
|
|
if (clock) /* might be NULL if surface was destroyed */
|
2013-11-11 23:17:38 +00:00
|
|
|
|
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
|
2012-09-26 14:28:06 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-11-11 23:04:34 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_event_queue_flush (GdkDisplay *display)
|
|
|
|
|
{
|
|
|
|
|
GList *tmp_list;
|
|
|
|
|
|
|
|
|
|
for (tmp_list = display->queued_events; tmp_list; tmp_list = tmp_list->next)
|
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
GdkEvent *event = tmp_list->data;
|
|
|
|
|
event->any.flags |= GDK_EVENT_FLUSHED;
|
2013-11-11 23:04:34 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
1998-12-15 13:54:20 +00:00
|
|
|
|
* gdk_event_handler_set:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* @func: the function to call to handle events from GDK.
|
|
|
|
|
* @data: user data to pass to the function.
|
|
|
|
|
* @notify: the function to call when the handler function is removed, i.e. when
|
|
|
|
|
* gdk_event_handler_set() is called with another event handler.
|
1998-12-15 13:54:20 +00:00
|
|
|
|
*
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* Sets the function to call to handle all events from GDK.
|
|
|
|
|
*
|
|
|
|
|
* Note that GTK+ uses this to install its own event handler, so it is
|
|
|
|
|
* usually not useful for GTK+ applications. (Although an application
|
|
|
|
|
* can call this function then call gtk_main_do_event() to pass
|
|
|
|
|
* events to GTK+.)
|
|
|
|
|
**/
|
1998-12-15 13:54:20 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_event_handler_set (GdkEventFunc func,
|
|
|
|
|
gpointer data,
|
|
|
|
|
GDestroyNotify notify)
|
|
|
|
|
{
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
if (_gdk_event_notify)
|
|
|
|
|
(*_gdk_event_notify) (_gdk_event_data);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
_gdk_event_func = func;
|
|
|
|
|
_gdk_event_data = data;
|
|
|
|
|
_gdk_event_notify = notify;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-22 22:11:22 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_new:
|
|
|
|
|
* @type: a #GdkEventType
|
|
|
|
|
*
|
|
|
|
|
* Creates a new event of the given type. All fields are set to 0.
|
|
|
|
|
*
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* Returns: a newly-allocated #GdkEvent. Free with g_object_unref()
|
|
|
|
|
*/
|
1999-11-08 20:14:59 +00:00
|
|
|
|
GdkEvent*
|
2002-10-03 20:53:30 +00:00
|
|
|
|
gdk_event_new (GdkEventType type)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
2017-10-25 13:49:19 +00:00
|
|
|
|
return g_object_new (GDK_TYPE_EVENT,
|
|
|
|
|
"event-type", type,
|
|
|
|
|
NULL);
|
|
|
|
|
}
|
2005-12-06 10:40:09 +00:00
|
|
|
|
|
2017-10-25 13:49:19 +00:00
|
|
|
|
static void
|
|
|
|
|
gdk_event_constructed (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GdkEvent *new_event = GDK_EVENT (object);
|
2002-10-02 21:39:09 +00:00
|
|
|
|
|
2002-10-03 20:53:30 +00:00
|
|
|
|
/*
|
|
|
|
|
* Bytewise 0 initialization is reasonable for most of the
|
|
|
|
|
* current event types. Explicitely initialize double fields
|
|
|
|
|
* since I trust bytewise 0 == 0. less than for integers
|
|
|
|
|
* or pointers.
|
|
|
|
|
*/
|
2017-10-25 13:49:19 +00:00
|
|
|
|
switch ((guint) new_event->any.type)
|
2002-10-03 20:53:30 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
new_event->motion.x = 0.;
|
|
|
|
|
new_event->motion.y = 0.;
|
|
|
|
|
new_event->motion.x_root = 0.;
|
|
|
|
|
new_event->motion.y_root = 0.;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
new_event->button.x = 0.;
|
|
|
|
|
new_event->button.y = 0.;
|
|
|
|
|
new_event->button.x_root = 0.;
|
|
|
|
|
new_event->button.y_root = 0.;
|
|
|
|
|
break;
|
2011-02-28 19:53:42 +00:00
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
new_event->touch.x = 0.;
|
|
|
|
|
new_event->touch.y = 0.;
|
|
|
|
|
new_event->touch.x_root = 0.;
|
|
|
|
|
new_event->touch.y_root = 0.;
|
|
|
|
|
break;
|
2002-10-03 20:53:30 +00:00
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
new_event->scroll.x = 0.;
|
|
|
|
|
new_event->scroll.y = 0.;
|
|
|
|
|
new_event->scroll.x_root = 0.;
|
|
|
|
|
new_event->scroll.y_root = 0.;
|
2012-01-23 22:37:44 +00:00
|
|
|
|
new_event->scroll.delta_x = 0.;
|
|
|
|
|
new_event->scroll.delta_y = 0.;
|
2015-10-21 00:14:40 +00:00
|
|
|
|
new_event->scroll.is_stop = FALSE;
|
2002-10-03 20:53:30 +00:00
|
|
|
|
break;
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
new_event->crossing.x = 0.;
|
|
|
|
|
new_event->crossing.y = 0.;
|
|
|
|
|
new_event->crossing.x_root = 0.;
|
|
|
|
|
new_event->crossing.y_root = 0.;
|
|
|
|
|
break;
|
2015-07-09 16:39:58 +00:00
|
|
|
|
case GDK_TOUCHPAD_SWIPE:
|
|
|
|
|
new_event->touchpad_swipe.x = 0;
|
|
|
|
|
new_event->touchpad_swipe.y = 0;
|
|
|
|
|
new_event->touchpad_swipe.dx = 0;
|
|
|
|
|
new_event->touchpad_swipe.dy = 0;
|
|
|
|
|
new_event->touchpad_swipe.x_root = 0;
|
|
|
|
|
new_event->touchpad_swipe.y_root = 0;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_TOUCHPAD_PINCH:
|
|
|
|
|
new_event->touchpad_pinch.x = 0;
|
|
|
|
|
new_event->touchpad_pinch.y = 0;
|
|
|
|
|
new_event->touchpad_pinch.dx = 0;
|
|
|
|
|
new_event->touchpad_pinch.dy = 0;
|
|
|
|
|
new_event->touchpad_pinch.angle_delta = 0;
|
|
|
|
|
new_event->touchpad_pinch.scale = 0;
|
|
|
|
|
new_event->touchpad_pinch.x_root = 0;
|
|
|
|
|
new_event->touchpad_pinch.y_root = 0;
|
|
|
|
|
break;
|
2002-10-03 20:53:30 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-10-25 13:49:19 +00:00
|
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (gdk_event_parent_class)->constructed (object);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-28 00:37:01 +00:00
|
|
|
|
void
|
2016-05-10 19:16:45 +00:00
|
|
|
|
gdk_event_set_pointer_emulated (GdkEvent *event,
|
|
|
|
|
gboolean emulated)
|
2011-12-28 00:37:01 +00:00
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (emulated)
|
|
|
|
|
event->any.flags |= GDK_EVENT_POINTER_EMULATED;
|
|
|
|
|
else
|
|
|
|
|
event->any.flags &= ~(GDK_EVENT_POINTER_EMULATED);
|
2011-12-28 00:37:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-10 19:22:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_pointer_emulated:
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @event: a #GdkEvent
|
2016-05-10 19:22:35 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns whether this event is an 'emulated' pointer event (typically
|
|
|
|
|
* from a touch event), as opposed to a real one.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if this event is emulated
|
|
|
|
|
*/
|
2011-12-28 00:37:01 +00:00
|
|
|
|
gboolean
|
2016-05-10 19:16:45 +00:00
|
|
|
|
gdk_event_get_pointer_emulated (GdkEvent *event)
|
2011-12-28 00:37:01 +00:00
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
return (event->any.flags & GDK_EVENT_POINTER_EMULATED) != 0;
|
2011-12-28 00:37:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-10-31 11:37:50 +00:00
|
|
|
|
static GdkTimeCoord *
|
|
|
|
|
copy_time_coord (const GdkTimeCoord *coord)
|
|
|
|
|
{
|
|
|
|
|
return g_memdup (coord, sizeof (GdkTimeCoord));
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_copy:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* Copies a #GdkEvent, copying or incrementing the reference count of the
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* resources associated with it (e.g. #GdkSurface’s and strings).
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer full): a copy of @event. Free with g_object_unref()
|
2017-12-21 19:07:02 +00:00
|
|
|
|
*/
|
1998-12-15 13:54:20 +00:00
|
|
|
|
GdkEvent*
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_copy (const GdkEvent *event)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
|
|
|
|
GdkEvent *new_event;
|
2011-01-20 03:52:55 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
g_return_val_if_fail (event != NULL, NULL);
|
2011-01-20 03:52:55 +00:00
|
|
|
|
|
2017-10-25 13:46:47 +00:00
|
|
|
|
new_event = gdk_event_new (event->any.type);
|
2002-10-03 20:53:30 +00:00
|
|
|
|
|
2017-10-25 11:23:41 +00:00
|
|
|
|
memcpy (EVENT_PAYLOAD (new_event),
|
|
|
|
|
EVENT_PAYLOAD (event),
|
|
|
|
|
EVENT_PAYLOAD_SIZE);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (new_event->any.surface)
|
|
|
|
|
g_object_ref (new_event->any.surface);
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (new_event->any.device)
|
|
|
|
|
g_object_ref (new_event->any.device);
|
|
|
|
|
if (new_event->any.source_device)
|
|
|
|
|
g_object_ref (new_event->any.source_device);
|
2002-10-03 20:53:30 +00:00
|
|
|
|
|
2017-10-25 11:23:41 +00:00
|
|
|
|
gdk_event_set_user_data (new_event, gdk_event_get_user_data (event));
|
2011-01-20 03:52:55 +00:00
|
|
|
|
|
2017-10-06 19:19:42 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
new_event->key.string = g_strdup (event->key.string);
|
|
|
|
|
break;
|
2011-01-20 03:52:55 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (event->crossing.child_surface != NULL)
|
|
|
|
|
g_object_ref (event->crossing.child_surface);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
break;
|
2011-01-20 03:52:55 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
case GDK_DRAG_ENTER:
|
|
|
|
|
case GDK_DRAG_LEAVE:
|
|
|
|
|
case GDK_DRAG_MOTION:
|
|
|
|
|
case GDK_DROP_START:
|
2002-09-25 07:23:55 +00:00
|
|
|
|
g_object_ref (event->dnd.context);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
break;
|
2011-01-20 03:52:55 +00:00
|
|
|
|
|
2001-03-09 13:28:26 +00:00
|
|
|
|
case GDK_EXPOSE:
|
|
|
|
|
if (event->expose.region)
|
2011-01-20 03:52:55 +00:00
|
|
|
|
new_event->expose.region = cairo_region_copy (event->expose.region);
|
2001-03-09 13:28:26 +00:00
|
|
|
|
break;
|
2011-01-20 03:52:55 +00:00
|
|
|
|
|
2003-02-18 20:14:56 +00:00
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
2011-01-20 03:52:55 +00:00
|
|
|
|
if (event->button.axes)
|
|
|
|
|
new_event->button.axes = g_memdup (event->button.axes,
|
2017-10-11 06:42:41 +00:00
|
|
|
|
sizeof (gdouble) * gdk_device_get_n_axes (event->any.device));
|
2017-10-31 11:21:29 +00:00
|
|
|
|
if (event->button.tool)
|
|
|
|
|
g_object_ref (new_event->button.tool);
|
2003-02-18 20:14:56 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2011-02-28 19:53:42 +00:00
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
if (event->touch.axes)
|
|
|
|
|
new_event->touch.axes = g_memdup (event->touch.axes,
|
2017-10-11 06:42:41 +00:00
|
|
|
|
sizeof (gdouble) * gdk_device_get_n_axes (event->any.device));
|
2011-02-28 19:53:42 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2003-02-18 20:14:56 +00:00
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2011-01-20 03:52:55 +00:00
|
|
|
|
if (event->motion.axes)
|
|
|
|
|
new_event->motion.axes = g_memdup (event->motion.axes,
|
2017-10-11 06:42:41 +00:00
|
|
|
|
sizeof (gdouble) * gdk_device_get_n_axes (event->any.device));
|
2017-10-31 11:21:29 +00:00
|
|
|
|
if (event->motion.tool)
|
|
|
|
|
g_object_ref (new_event->motion.tool);
|
2017-10-31 11:37:50 +00:00
|
|
|
|
|
|
|
|
|
if (event->motion.history)
|
|
|
|
|
{
|
|
|
|
|
new_event->motion.history = g_list_copy_deep (event->motion.history,
|
|
|
|
|
(GCopyFunc) copy_time_coord, NULL);
|
|
|
|
|
}
|
2003-02-18 20:14:56 +00:00
|
|
|
|
break;
|
2010-11-23 19:25:13 +00:00
|
|
|
|
|
2001-04-02 23:33:47 +00:00
|
|
|
|
default:
|
1998-12-15 13:54:20 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2008-05-06 21:00:06 +00:00
|
|
|
|
|
2017-10-25 12:21:38 +00:00
|
|
|
|
_gdk_display_event_data_copy (gdk_event_get_display (event), event, new_event);
|
2010-12-15 05:37:40 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
return new_event;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_free:
|
|
|
|
|
* @event: a #GdkEvent.
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* Frees a #GdkEvent, freeing or decrementing any resources associated with it.
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
|
|
|
|
* This is equivalent to g_object_unref().
|
|
|
|
|
*/
|
1998-12-15 13:54:20 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_event_free (GdkEvent *event)
|
|
|
|
|
{
|
2017-10-25 11:23:41 +00:00
|
|
|
|
g_object_unref (event);
|
|
|
|
|
}
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2017-10-25 11:23:41 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_event_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GdkEvent *event = GDK_EVENT (object);
|
|
|
|
|
GdkDisplay *display;
|
2015-08-03 15:22:29 +00:00
|
|
|
|
|
2017-10-06 19:19:42 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
g_free (event->key.string);
|
|
|
|
|
break;
|
2017-10-11 06:42:41 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_clear_object (&event->crossing.child_surface);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
break;
|
2017-10-11 06:42:41 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
case GDK_DRAG_ENTER:
|
|
|
|
|
case GDK_DRAG_LEAVE:
|
|
|
|
|
case GDK_DRAG_MOTION:
|
|
|
|
|
case GDK_DROP_START:
|
2010-09-24 14:30:07 +00:00
|
|
|
|
if (event->dnd.context != NULL)
|
|
|
|
|
g_object_unref (event->dnd.context);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
break;
|
2000-07-03 19:00:23 +00:00
|
|
|
|
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
2017-10-11 06:42:41 +00:00
|
|
|
|
g_clear_object (&event->button.tool);
|
2007-03-09 21:57:37 +00:00
|
|
|
|
g_free (event->button.axes);
|
2000-07-03 19:00:23 +00:00
|
|
|
|
break;
|
2011-02-28 19:53:42 +00:00
|
|
|
|
|
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
g_free (event->touch.axes);
|
|
|
|
|
break;
|
|
|
|
|
|
2001-03-09 13:28:26 +00:00
|
|
|
|
case GDK_EXPOSE:
|
|
|
|
|
if (event->expose.region)
|
2010-06-28 12:44:12 +00:00
|
|
|
|
cairo_region_destroy (event->expose.region);
|
2001-03-09 13:28:26 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2017-10-11 06:42:41 +00:00
|
|
|
|
g_clear_object (&event->motion.tool);
|
2007-03-09 21:57:37 +00:00
|
|
|
|
g_free (event->motion.axes);
|
2017-10-31 11:37:50 +00:00
|
|
|
|
g_list_free_full (event->motion.history, g_free);
|
2000-07-03 19:00:23 +00:00
|
|
|
|
break;
|
2011-01-31 05:43:18 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-10-02 21:39:09 +00:00
|
|
|
|
|
2017-12-12 23:35:16 +00:00
|
|
|
|
display = gdk_event_get_display (event);
|
2011-04-09 01:20:26 +00:00
|
|
|
|
if (display)
|
|
|
|
|
_gdk_display_event_data_free (display, event);
|
2008-05-06 21:00:06 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (event->any.surface)
|
|
|
|
|
g_object_unref (event->any.surface);
|
2014-11-01 18:44:03 +00:00
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
g_clear_object (&event->any.device);
|
|
|
|
|
g_clear_object (&event->any.source_device);
|
|
|
|
|
|
2017-10-25 11:23:41 +00:00
|
|
|
|
G_OBJECT_CLASS (gdk_event_parent_class)->finalize (object);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-10 10:20:28 +00:00
|
|
|
|
/**
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* gdk_event_get_surface:
|
2013-09-10 10:20:28 +00:00
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Extracts the #GdkSurface associated with an event.
|
2013-09-10 10:20:28 +00:00
|
|
|
|
*
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* Returns: (transfer none): The #GdkSurface associated with the event
|
2013-09-10 10:20:28 +00:00
|
|
|
|
*/
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurface *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_event_get_surface (const GdkEvent *event)
|
2013-09-10 10:20:28 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, NULL);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return event->any.surface;
|
2013-09-10 10:20:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-12-18 19:12:35 +00:00
|
|
|
|
/**
|
1998-12-15 13:54:20 +00:00
|
|
|
|
* gdk_event_get_time:
|
2000-12-18 19:12:35 +00:00
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Returns the time stamp from @event, if there is one; otherwise
|
|
|
|
|
* returns #GDK_CURRENT_TIME. If @event is %NULL, returns #GDK_CURRENT_TIME.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: time stamp field from @event
|
2000-12-18 19:12:35 +00:00
|
|
|
|
**/
|
1998-12-15 13:54:20 +00:00
|
|
|
|
guint32
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_get_time (const GdkEvent *event)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
|
|
|
|
if (event)
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch (event->any.type)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
return event->motion.time;
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
return event->button.time;
|
2011-02-28 19:53:42 +00:00
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
return event->touch.time;
|
2015-07-09 16:39:58 +00:00
|
|
|
|
case GDK_TOUCHPAD_SWIPE:
|
|
|
|
|
return event->touchpad_swipe.time;
|
|
|
|
|
case GDK_TOUCHPAD_PINCH:
|
|
|
|
|
return event->touchpad_pinch.time;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
return event->scroll.time;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
return event->key.time;
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
return event->crossing.time;
|
|
|
|
|
case GDK_PROXIMITY_IN:
|
|
|
|
|
case GDK_PROXIMITY_OUT:
|
|
|
|
|
return event->proximity.time;
|
|
|
|
|
case GDK_DRAG_ENTER:
|
|
|
|
|
case GDK_DRAG_LEAVE:
|
|
|
|
|
case GDK_DRAG_MOTION:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
return event->dnd.time;
|
2016-08-04 17:04:36 +00:00
|
|
|
|
case GDK_PAD_BUTTON_PRESS:
|
|
|
|
|
case GDK_PAD_BUTTON_RELEASE:
|
|
|
|
|
return event->pad_button.time;
|
|
|
|
|
case GDK_PAD_RING:
|
|
|
|
|
case GDK_PAD_STRIP:
|
|
|
|
|
return event->pad_axis.time;
|
|
|
|
|
case GDK_PAD_GROUP_MODE:
|
|
|
|
|
return event->pad_group_mode.time;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
case GDK_CONFIGURE:
|
|
|
|
|
case GDK_FOCUS_CHANGE:
|
|
|
|
|
case GDK_NOTHING:
|
|
|
|
|
case GDK_DELETE:
|
|
|
|
|
case GDK_DESTROY:
|
|
|
|
|
case GDK_EXPOSE:
|
|
|
|
|
case GDK_MAP:
|
|
|
|
|
case GDK_UNMAP:
|
2005-06-26 07:06:13 +00:00
|
|
|
|
case GDK_GRAB_BROKEN:
|
2009-01-27 14:10:45 +00:00
|
|
|
|
case GDK_EVENT_LAST:
|
2017-10-06 19:19:42 +00:00
|
|
|
|
default:
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
/* return current time */
|
|
|
|
|
break;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return GDK_CURRENT_TIME;
|
|
|
|
|
}
|
|
|
|
|
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_state:
|
2014-05-17 03:12:51 +00:00
|
|
|
|
* @event: (allow-none): a #GdkEvent or %NULL
|
2010-06-07 21:47:14 +00:00
|
|
|
|
* @state: (out): return location for state
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
|
|
|
|
* If the event contains a “state” field, puts that field in @state.
|
|
|
|
|
*
|
|
|
|
|
* Otherwise stores an empty state (0).
|
|
|
|
|
* @event may be %NULL, in which case it’s treated
|
2000-12-18 19:12:35 +00:00
|
|
|
|
* as if the event had no state field.
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if there was a state field in the event
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
2017-12-26 15:59:38 +00:00
|
|
|
|
gdk_event_get_state (const GdkEvent *event,
|
|
|
|
|
GdkModifierType *state)
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
{
|
2000-12-18 19:12:35 +00:00
|
|
|
|
g_return_val_if_fail (state != NULL, FALSE);
|
|
|
|
|
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
if (event)
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch (event->any.type)
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2000-12-18 19:12:35 +00:00
|
|
|
|
*state = event->motion.state;
|
|
|
|
|
return TRUE;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
2011-02-28 19:53:42 +00:00
|
|
|
|
*state = event->button.state;
|
|
|
|
|
return TRUE;
|
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
*state = event->touch.state;
|
2000-12-18 19:12:35 +00:00
|
|
|
|
return TRUE;
|
2015-07-09 16:39:58 +00:00
|
|
|
|
case GDK_TOUCHPAD_SWIPE:
|
|
|
|
|
*state = event->touchpad_swipe.state;
|
|
|
|
|
return TRUE;
|
|
|
|
|
case GDK_TOUCHPAD_PINCH:
|
|
|
|
|
*state = event->touchpad_pinch.state;
|
|
|
|
|
return TRUE;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
case GDK_SCROLL:
|
2000-12-18 19:12:35 +00:00
|
|
|
|
*state = event->scroll.state;
|
|
|
|
|
return TRUE;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
2000-12-18 19:12:35 +00:00
|
|
|
|
*state = event->key.state;
|
|
|
|
|
return TRUE;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
2000-12-18 19:12:35 +00:00
|
|
|
|
*state = event->crossing.state;
|
|
|
|
|
return TRUE;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
case GDK_CONFIGURE:
|
|
|
|
|
case GDK_FOCUS_CHANGE:
|
|
|
|
|
case GDK_PROXIMITY_IN:
|
|
|
|
|
case GDK_PROXIMITY_OUT:
|
|
|
|
|
case GDK_DRAG_ENTER:
|
|
|
|
|
case GDK_DRAG_LEAVE:
|
|
|
|
|
case GDK_DRAG_MOTION:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
case GDK_NOTHING:
|
|
|
|
|
case GDK_DELETE:
|
|
|
|
|
case GDK_DESTROY:
|
|
|
|
|
case GDK_EXPOSE:
|
|
|
|
|
case GDK_MAP:
|
|
|
|
|
case GDK_UNMAP:
|
2005-06-26 07:06:13 +00:00
|
|
|
|
case GDK_GRAB_BROKEN:
|
2016-08-04 17:04:36 +00:00
|
|
|
|
case GDK_PAD_BUTTON_PRESS:
|
|
|
|
|
case GDK_PAD_BUTTON_RELEASE:
|
|
|
|
|
case GDK_PAD_RING:
|
|
|
|
|
case GDK_PAD_STRIP:
|
|
|
|
|
case GDK_PAD_GROUP_MODE:
|
2009-01-27 14:10:45 +00:00
|
|
|
|
case GDK_EVENT_LAST:
|
2017-10-06 19:19:42 +00:00
|
|
|
|
default:
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
/* no state field */
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2000-12-18 19:12:35 +00:00
|
|
|
|
*state = 0;
|
|
|
|
|
return FALSE;
|
Port to GObject, can go back in gdk-pixbuf after setting up a
2000-12-16 Havoc Pennington <hp@pobox.com>
* gtk/gdk-pixbuf-loader.h, gtk/gdk-pixbuf-loader.c:
Port to GObject, can go back in gdk-pixbuf after setting up
a gdk-pixbuf-marshal.h header over there.
* gtk/gtktreeview.c: s/SEPERATOR/SEPARATOR/g;
(gtk_tree_view_class_init): specify GTK_TYPE_ADJUSTMENT for signal
args
(gtk_tree_view_init): don't unset GTK_NO_WINDOW, it shouldn't be
set
(gtk_tree_view_realize_buttons): don't gtk_widget_show() buttons
here, do it when we create the buttons later
(gtk_tree_view_realize_buttons): add some g_return_if_fail
(gtk_tree_view_map): paranoia checks that column->button is shown
and unmapped
(gtk_tree_view_size_request): only request visible children.
Move header size calculation in here, for cleanliness, and
to maintain invariants for child widgets if we eventually
let users set different children inside the buttons
(gtk_tree_view_map_buttons): factor out code to map buttons,
since it was being called several times
(gtk_tree_view_size_allocate_buttons): move_resize the drag
windows instead of just moving them; their height may change
if we allow random widgets in there, or the theme changes.
(gtk_tree_view_size_allocate): move button size allocation
above emitting the scroll signals, to ensure a sane state when we
hit user code
(gtk_tree_view_button_release): remove queue_resize after
tree_view_set_size(), set_size() will handle any resize queuing
that's needed
(gtk_tree_view_focus_in): just queue a draw, don't fool with
draw_focus goo
(gtk_tree_view_focus): use gtk_get_current_event() and
gdk_event_get_state()
(gtk_tree_view_deleted): don't queue_resize() after calling set_size()
(gtk_tree_view_build_tree): fix a "if (foo); {}" bug - i.e. remove
semicolon
(gtk_tree_view_create_button): show the button here
(gtk_tree_view_button_clicked): actually emit the clicked signal
on the column
(_gtk_tree_view_set_size): return right away if the size is
unchanged, as a cheesy optimization
(gtk_tree_view_setup_model): rename set_model_realized to
setup_model to match the flag that indicates whether we've
called it
(gtk_tree_view_get_hadjustment): create adjustment if it doesn't
exist, because set_scroll_adjustment does that and it shouldn't
matter what order you call these in
(gtk_tree_view_get_vadjustment): ditto
(gtk_tree_view_set_headers_visible): canonicalize the bool,
for paranoia
(gtk_tree_view_set_headers_visible): call
gtk_tree_view_map_buttons() instead of using cut-and-paste code
(gtk_tree_view_append_column): clarify whether the return value
is the count of columns before or after, and do the increment
separately from the return statement so you can tell from the code.
(gtk_tree_view_remove_column): ditto
(gtk_tree_view_insert_column): ditto
(gtk_tree_view_get_column): remove g_return_if_fail for columns
outside the existing range, the docs say that outside-range
columns are allowed, so we handle them as documented. (Presumably
this allows a nice loop with column != NULL as test.)
(gtk_tree_view_move_to): document what 0.0, 0.5, 1.0 alignments
mean (left/right/center etc.).
(gtk_tree_view_collapse_all): only queue a draw if we're mapped
(gtk_tree_view_expand_row): add docs
(gtk_tree_view_collapse_row): add docs
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_clicked): new
function to emit the clicked signal on a column
* gdk/gdkevents.c (gdk_event_get_state): new function, to get the
state of an event
(gdk_event_get_time): don't treat GDK_SCROLL
as a button event, remove default case from switch so gcc
will whine if we don't explicitly handle all event types
* gtk/gtktreeselection.h: added some FIXME
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): rename
"columns" to "n_columns" and "column" to "columns" for clarity
2000-12-17 23:50:00 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-28 22:49:20 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_coords:
|
|
|
|
|
* @event: a #GdkEvent
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @x_win: (out) (optional): location to put event surface x coordinate
|
|
|
|
|
* @y_win: (out) (optional): location to put event surface y coordinate
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Extract the event surface relative x/y coordinates from an event.
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered event surface coordinates
|
2001-06-28 22:49:20 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_get_coords (const GdkEvent *event,
|
|
|
|
|
gdouble *x_win,
|
|
|
|
|
gdouble *y_win)
|
2001-06-28 22:49:20 +00:00
|
|
|
|
{
|
|
|
|
|
gdouble x = 0, y = 0;
|
|
|
|
|
gboolean fetched = TRUE;
|
2017-12-26 15:59:38 +00:00
|
|
|
|
|
2001-06-28 22:49:20 +00:00
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2001-06-28 22:49:20 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_CONFIGURE:
|
|
|
|
|
x = event->configure.x;
|
|
|
|
|
y = event->configure.y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
x = event->crossing.x;
|
|
|
|
|
y = event->crossing.y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
x = event->scroll.x;
|
|
|
|
|
y = event->scroll.y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
x = event->button.x;
|
|
|
|
|
y = event->button.y;
|
|
|
|
|
break;
|
2011-02-28 19:53:42 +00:00
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
x = event->touch.x;
|
|
|
|
|
y = event->touch.y;
|
|
|
|
|
break;
|
2001-06-28 22:49:20 +00:00
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
x = event->motion.x;
|
|
|
|
|
y = event->motion.y;
|
|
|
|
|
break;
|
2015-07-09 16:39:58 +00:00
|
|
|
|
case GDK_TOUCHPAD_SWIPE:
|
|
|
|
|
x = event->touchpad_swipe.x;
|
|
|
|
|
y = event->touchpad_swipe.y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_TOUCHPAD_PINCH:
|
|
|
|
|
x = event->touchpad_pinch.x;
|
|
|
|
|
y = event->touchpad_pinch.y;
|
|
|
|
|
break;
|
2001-06-28 22:49:20 +00:00
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x_win)
|
|
|
|
|
*x_win = x;
|
|
|
|
|
if (y_win)
|
2001-11-24 00:24:18 +00:00
|
|
|
|
*y_win = y;
|
2001-06-28 22:49:20 +00:00
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_root_coords:
|
|
|
|
|
* @event: a #GdkEvent
|
2015-07-24 12:36:30 +00:00
|
|
|
|
* @x_root: (out) (optional): location to put root window x coordinate
|
|
|
|
|
* @y_root: (out) (optional): location to put root window y coordinate
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2001-06-28 22:49:20 +00:00
|
|
|
|
* Extract the root window relative x/y coordinates from an event.
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered root window coordinates
|
2001-06-28 22:49:20 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_get_root_coords (const GdkEvent *event,
|
|
|
|
|
gdouble *x_root,
|
|
|
|
|
gdouble *y_root)
|
2001-06-28 22:49:20 +00:00
|
|
|
|
{
|
|
|
|
|
gdouble x = 0, y = 0;
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2001-06-28 22:49:20 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
x = event->motion.x_root;
|
|
|
|
|
y = event->motion.y_root;
|
|
|
|
|
break;
|
2004-11-23 03:58:59 +00:00
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
x = event->scroll.x_root;
|
|
|
|
|
y = event->scroll.y_root;
|
|
|
|
|
break;
|
2001-06-28 22:49:20 +00:00
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
x = event->button.x_root;
|
|
|
|
|
y = event->button.y_root;
|
|
|
|
|
break;
|
2011-02-28 19:53:42 +00:00
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
x = event->touch.x_root;
|
|
|
|
|
y = event->touch.y_root;
|
|
|
|
|
break;
|
2001-06-28 22:49:20 +00:00
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
x = event->crossing.x_root;
|
|
|
|
|
y = event->crossing.y_root;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_DRAG_ENTER:
|
|
|
|
|
case GDK_DRAG_LEAVE:
|
|
|
|
|
case GDK_DRAG_MOTION:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
x = event->dnd.x_root;
|
|
|
|
|
y = event->dnd.y_root;
|
|
|
|
|
break;
|
2015-07-09 16:39:58 +00:00
|
|
|
|
case GDK_TOUCHPAD_SWIPE:
|
|
|
|
|
x = event->touchpad_swipe.x_root;
|
|
|
|
|
y = event->touchpad_swipe.y_root;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_TOUCHPAD_PINCH:
|
|
|
|
|
x = event->touchpad_pinch.x_root;
|
|
|
|
|
y = event->touchpad_pinch.y_root;
|
|
|
|
|
break;
|
2001-06-28 22:49:20 +00:00
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x_root)
|
|
|
|
|
*x_root = x;
|
|
|
|
|
if (y_root)
|
2002-03-22 17:47:51 +00:00
|
|
|
|
*y_root = y;
|
2001-06-28 22:49:20 +00:00
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-31 14:51:42 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_event_set_coords (GdkEvent *event,
|
|
|
|
|
gdouble x,
|
|
|
|
|
gdouble y)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (event != NULL);
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2017-03-31 14:51:42 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_CONFIGURE:
|
|
|
|
|
event->configure.x = x;
|
|
|
|
|
event->configure.y = y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
event->crossing.x = x;
|
|
|
|
|
event->crossing.y = y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
event->scroll.x = x;
|
|
|
|
|
event->scroll.y = y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
event->button.x = x;
|
|
|
|
|
event->button.y = y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
event->touch.x = x;
|
|
|
|
|
event->touch.y = y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
event->motion.x = x;
|
|
|
|
|
event->motion.y = y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_TOUCHPAD_SWIPE:
|
|
|
|
|
event->touchpad_swipe.x = x;
|
|
|
|
|
event->touchpad_swipe.y = y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_TOUCHPAD_PINCH:
|
|
|
|
|
event->touchpad_pinch.x = x;
|
|
|
|
|
event->touchpad_pinch.y = y;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-28 19:26:47 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_button:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @button: (out): location to store mouse button number
|
|
|
|
|
*
|
|
|
|
|
* Extract the button number from an event.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered a button number
|
2011-08-28 19:26:47 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_button (const GdkEvent *event,
|
|
|
|
|
guint *button)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
guint number = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2011-08-28 19:26:47 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
number = event->button.button;
|
|
|
|
|
break;
|
2016-08-04 17:04:36 +00:00
|
|
|
|
case GDK_PAD_BUTTON_PRESS:
|
|
|
|
|
case GDK_PAD_BUTTON_RELEASE:
|
|
|
|
|
number = event->pad_button.button;
|
|
|
|
|
break;
|
2011-08-28 19:26:47 +00:00
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (button)
|
|
|
|
|
*button = number;
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_click_count:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @click_count: (out): location to store click count
|
|
|
|
|
*
|
|
|
|
|
* Extracts the click count from an event.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered a click count
|
2011-08-28 19:26:47 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_click_count (const GdkEvent *event,
|
|
|
|
|
guint *click_count)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
guint number = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2011-08-28 19:26:47 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
number = 1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (click_count)
|
|
|
|
|
*click_count = number;
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_keyval:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @keyval: (out): location to store the keyval
|
|
|
|
|
*
|
|
|
|
|
* Extracts the keyval from an event.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered a key symbol
|
2011-08-28 19:26:47 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_keyval (const GdkEvent *event,
|
|
|
|
|
guint *keyval)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
guint number = 0;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2011-08-28 19:26:47 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
number = event->key.keyval;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (keyval)
|
|
|
|
|
*keyval = number;
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-26 14:50:15 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_event_set_keyval (GdkEvent *event,
|
|
|
|
|
guint keyval)
|
|
|
|
|
{
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_KEY_PRESS ||
|
|
|
|
|
event->any.type == GDK_KEY_RELEASE)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
event->key.keyval = keyval;
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-28 19:26:47 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_keycode:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @keycode: (out): location to store the keycode
|
|
|
|
|
*
|
|
|
|
|
* Extracts the hardware keycode from an event.
|
|
|
|
|
*
|
2016-05-01 15:28:37 +00:00
|
|
|
|
* Also see gdk_event_get_scancode().
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered a hardware keycode
|
2011-08-28 19:26:47 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_keycode (const GdkEvent *event,
|
|
|
|
|
guint16 *keycode)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
guint16 number = 0;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2011-08-28 19:26:47 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
number = event->key.hardware_keycode;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (keycode)
|
|
|
|
|
*keycode = number;
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_key_group:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @group: (out): return location for the key group
|
|
|
|
|
*
|
|
|
|
|
* Extracts the key group from an event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_key_group (const GdkEvent *event,
|
|
|
|
|
guint *group)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
*group = event->key.group;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
*group = 0;
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_string:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @string: (out) (transfer none): return location for the string
|
|
|
|
|
*
|
|
|
|
|
* Extracts a string from an event. The string is an
|
|
|
|
|
* approximation of the keyval in a key event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_string (const GdkEvent *event,
|
|
|
|
|
const char **string)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
*string = event->key.string;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
*string = NULL;
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_key_is_modifier:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @is_modifier: (out): return location for the value
|
|
|
|
|
*
|
|
|
|
|
* Extracts whether the event is a key event for
|
|
|
|
|
* a modifier key.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_key_is_modifier (const GdkEvent *event,
|
|
|
|
|
gboolean *is_modifier)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
*is_modifier = event->key.is_modifier;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
*is_modifier = FALSE;
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
2011-08-28 19:26:47 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_scroll_direction:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @direction: (out): location to store the scroll direction
|
|
|
|
|
*
|
|
|
|
|
* Extracts the scroll direction from an event.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered a scroll direction
|
2011-08-28 19:26:47 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_scroll_direction (const GdkEvent *event,
|
|
|
|
|
GdkScrollDirection *direction)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
GdkScrollDirection dir = 0;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2011-08-28 19:26:47 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_SCROLL:
|
2012-01-23 22:51:24 +00:00
|
|
|
|
if (event->scroll.direction == GDK_SCROLL_SMOOTH)
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
else
|
|
|
|
|
dir = event->scroll.direction;
|
2011-08-28 19:26:47 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (direction)
|
|
|
|
|
*direction = dir;
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
2012-01-23 22:37:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_scroll_deltas:
|
|
|
|
|
* @event: a #GdkEvent
|
2012-06-09 21:45:23 +00:00
|
|
|
|
* @delta_x: (out): return location for X delta
|
|
|
|
|
* @delta_y: (out): return location for Y delta
|
2012-01-23 22:37:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Retrieves the scroll deltas from a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the event contains smooth scroll information
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_scroll_deltas (const GdkEvent *event,
|
|
|
|
|
gdouble *delta_x,
|
|
|
|
|
gdouble *delta_y)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
gdouble dx = 0.0;
|
|
|
|
|
gdouble dy = 0.0;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2012-01-23 22:37:44 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
if (event->scroll.direction == GDK_SCROLL_SMOOTH)
|
|
|
|
|
{
|
|
|
|
|
dx = event->scroll.delta_x;
|
|
|
|
|
dy = event->scroll.delta_y;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (delta_x)
|
|
|
|
|
*delta_x = dx;
|
|
|
|
|
|
|
|
|
|
if (delta_y)
|
|
|
|
|
*delta_y = dy;
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-21 00:14:40 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_is_scroll_stop_event
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Check whether a scroll event is a stop scroll event. Scroll sequences
|
|
|
|
|
* with smooth scroll information may provide a stop scroll event once the
|
|
|
|
|
* interaction with the device finishes, e.g. by lifting a finger. This
|
|
|
|
|
* stop scroll event is the signal that a widget may trigger kinetic
|
|
|
|
|
* scrolling based on the current velocity.
|
|
|
|
|
*
|
|
|
|
|
* Stop scroll events always have a a delta of 0/0.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the event is a scroll stop event
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_is_scroll_stop_event (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
return event->scroll.is_stop;
|
|
|
|
|
}
|
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_axis:
|
|
|
|
|
* @event: a #GdkEvent
|
2011-01-18 09:10:30 +00:00
|
|
|
|
* @axis_use: the axis use to look for
|
2010-06-07 21:47:14 +00:00
|
|
|
|
* @value: (out): location to store the value found
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2000-07-03 19:00:23 +00:00
|
|
|
|
* Extract the axis value for a particular axis use from
|
|
|
|
|
* an event structure.
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the specified axis was found, otherwise %FALSE
|
2000-07-03 19:00:23 +00:00
|
|
|
|
**/
|
|
|
|
|
gboolean
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_get_axis (const GdkEvent *event,
|
|
|
|
|
GdkAxisUse axis_use,
|
|
|
|
|
gdouble *value)
|
2000-07-03 19:00:23 +00:00
|
|
|
|
{
|
|
|
|
|
gdouble *axes;
|
2017-10-11 06:42:41 +00:00
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
2017-12-26 15:59:38 +00:00
|
|
|
|
|
2000-07-03 19:00:23 +00:00
|
|
|
|
if (axis_use == GDK_AXIS_X || axis_use == GDK_AXIS_Y)
|
|
|
|
|
{
|
|
|
|
|
gdouble x, y;
|
2017-12-26 15:59:38 +00:00
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
switch ((guint) event->any.type)
|
2000-07-03 19:00:23 +00:00
|
|
|
|
{
|
2011-02-28 19:53:42 +00:00
|
|
|
|
case GDK_MOTION_NOTIFY:
|
2000-07-03 19:00:23 +00:00
|
|
|
|
x = event->motion.x;
|
|
|
|
|
y = event->motion.y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
x = event->scroll.x;
|
|
|
|
|
y = event->scroll.y;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
x = event->button.x;
|
|
|
|
|
y = event->button.y;
|
|
|
|
|
break;
|
2011-02-28 19:53:42 +00:00
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
|
|
|
|
x = event->touch.x;
|
|
|
|
|
y = event->touch.y;
|
|
|
|
|
break;
|
2000-07-03 19:00:23 +00:00
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
x = event->crossing.x;
|
|
|
|
|
y = event->crossing.y;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (axis_use == GDK_AXIS_X && value)
|
|
|
|
|
*value = x;
|
|
|
|
|
if (axis_use == GDK_AXIS_Y && value)
|
|
|
|
|
*value = y;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_BUTTON_PRESS ||
|
|
|
|
|
event->any.type == GDK_BUTTON_RELEASE)
|
2000-07-03 19:00:23 +00:00
|
|
|
|
{
|
|
|
|
|
axes = event->button.axes;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_TOUCH_BEGIN ||
|
|
|
|
|
event->any.type == GDK_TOUCH_UPDATE ||
|
|
|
|
|
event->any.type == GDK_TOUCH_END ||
|
|
|
|
|
event->any.type == GDK_TOUCH_CANCEL)
|
2011-02-28 19:53:42 +00:00
|
|
|
|
{
|
|
|
|
|
axes = event->touch.axes;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_MOTION_NOTIFY)
|
2000-07-03 19:00:23 +00:00
|
|
|
|
{
|
|
|
|
|
axes = event->motion.axes;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
return gdk_device_get_axis (event->any.device, axes, axis_use, value);
|
2000-07-03 19:00:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_set_device:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @device: a #GdkDevice
|
|
|
|
|
*
|
|
|
|
|
* Sets the device for @event to @device. The event must
|
|
|
|
|
* have been allocated by GTK+, for instance, by
|
|
|
|
|
* gdk_event_copy().
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_device (GdkEvent *event,
|
|
|
|
|
GdkDevice *device)
|
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
g_set_object (&event->any.device, device);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_device:
|
|
|
|
|
* @event: a #GdkEvent.
|
|
|
|
|
*
|
2014-02-05 19:50:22 +00:00
|
|
|
|
* If the event contains a “device” field, this function will return
|
2010-05-25 22:38:44 +00:00
|
|
|
|
* it, else it will return %NULL.
|
|
|
|
|
*
|
2014-05-08 19:55:50 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): a #GdkDevice, or %NULL.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
**/
|
|
|
|
|
GdkDevice *
|
|
|
|
|
gdk_event_get_device (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, NULL);
|
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
return event->any.device;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-13 01:12:43 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_set_source_device:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @device: a #GdkDevice
|
|
|
|
|
*
|
2011-01-20 03:52:55 +00:00
|
|
|
|
* Sets the slave device for @event to @device.
|
|
|
|
|
*
|
|
|
|
|
* The event must have been allocated by GTK+,
|
|
|
|
|
* for instance by gdk_event_copy().
|
2010-12-13 01:12:43 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_source_device (GdkEvent *event,
|
|
|
|
|
GdkDevice *device)
|
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
g_set_object (&event->any.source_device, device);
|
2010-12-13 01:12:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_source_device:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
2011-01-20 03:52:55 +00:00
|
|
|
|
* This function returns the hardware (slave) #GdkDevice that has
|
|
|
|
|
* triggered the event, falling back to the virtual (master) device
|
2014-02-07 18:32:47 +00:00
|
|
|
|
* (as in gdk_event_get_device()) if the event wasn’t caused by
|
2011-01-20 03:52:55 +00:00
|
|
|
|
* interaction with a hardware device. This may happen for example
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* in synthesized crossing events after a #GdkSurface updates its
|
2011-01-20 03:52:55 +00:00
|
|
|
|
* geometry or a grab is acquired/released.
|
2010-12-13 01:12:43 +00:00
|
|
|
|
*
|
2011-01-20 03:52:55 +00:00
|
|
|
|
* If the event does not contain a device field, this function will
|
|
|
|
|
* return %NULL.
|
2010-12-13 01:12:43 +00:00
|
|
|
|
*
|
2014-05-08 19:55:50 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): a #GdkDevice, or %NULL.
|
2010-12-13 01:12:43 +00:00
|
|
|
|
**/
|
|
|
|
|
GdkDevice *
|
|
|
|
|
gdk_event_get_source_device (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, NULL);
|
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (event->any.source_device)
|
|
|
|
|
return event->any.source_device;
|
2010-12-13 01:12:43 +00:00
|
|
|
|
|
|
|
|
|
/* Fallback to event device */
|
|
|
|
|
return gdk_event_get_device (event);
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-27 13:37:28 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_triggers_context_menu:
|
|
|
|
|
* @event: a #GdkEvent, currently only button events are meaningful values
|
|
|
|
|
*
|
|
|
|
|
* This function returns whether a #GdkEventButton should trigger a
|
|
|
|
|
* context menu, according to platform conventions. The right mouse
|
|
|
|
|
* button always triggers context menus. Additionally, if
|
|
|
|
|
* gdk_keymap_get_modifier_mask() returns a non-0 mask for
|
|
|
|
|
* %GDK_MODIFIER_INTENT_CONTEXT_MENU, then the left mouse button will
|
|
|
|
|
* also trigger a context menu if this modifier is pressed.
|
|
|
|
|
*
|
|
|
|
|
* This function should always be used instead of simply checking for
|
2012-01-25 17:10:48 +00:00
|
|
|
|
* event->button == %GDK_BUTTON_SECONDARY.
|
2011-09-27 13:37:28 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the event should trigger a context menu.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_triggers_context_menu (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_BUTTON_PRESS)
|
2011-09-27 13:37:28 +00:00
|
|
|
|
{
|
|
|
|
|
const GdkEventButton *bevent = (const GdkEventButton *) event;
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
GdkModifierType modifier;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (bevent->any.surface), FALSE);
|
2011-09-27 13:37:28 +00:00
|
|
|
|
|
2012-01-25 17:10:48 +00:00
|
|
|
|
if (bevent->button == GDK_BUTTON_SECONDARY &&
|
2011-09-27 13:37:28 +00:00
|
|
|
|
! (bevent->state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK)))
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (bevent->any.surface);
|
2011-09-27 13:37:28 +00:00
|
|
|
|
|
2017-12-15 12:44:58 +00:00
|
|
|
|
modifier = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
|
2011-09-27 13:37:28 +00:00
|
|
|
|
GDK_MODIFIER_INTENT_CONTEXT_MENU);
|
|
|
|
|
|
|
|
|
|
if (modifier != 0 &&
|
2012-01-25 17:10:48 +00:00
|
|
|
|
bevent->button == GDK_BUTTON_PRIMARY &&
|
2011-09-27 13:37:28 +00:00
|
|
|
|
! (bevent->state & (GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) &&
|
|
|
|
|
(bevent->state & modifier))
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gdk_events_get_axis_distances (GdkEvent *event1,
|
|
|
|
|
GdkEvent *event2,
|
|
|
|
|
gdouble *x_distance,
|
|
|
|
|
gdouble *y_distance,
|
|
|
|
|
gdouble *distance)
|
|
|
|
|
{
|
|
|
|
|
gdouble x1, x2, y1, y2;
|
|
|
|
|
gdouble xd, yd;
|
|
|
|
|
|
|
|
|
|
if (!gdk_event_get_coords (event1, &x1, &y1) ||
|
|
|
|
|
!gdk_event_get_coords (event2, &x2, &y2))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
xd = x2 - x1;
|
|
|
|
|
yd = y2 - y1;
|
|
|
|
|
|
|
|
|
|
if (x_distance)
|
|
|
|
|
*x_distance = xd;
|
|
|
|
|
|
|
|
|
|
if (y_distance)
|
|
|
|
|
*y_distance = yd;
|
|
|
|
|
|
|
|
|
|
if (distance)
|
|
|
|
|
*distance = sqrt ((xd * xd) + (yd * yd));
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_events_get_distance:
|
|
|
|
|
* @event1: first #GdkEvent
|
|
|
|
|
* @event2: second #GdkEvent
|
2011-01-18 09:10:30 +00:00
|
|
|
|
* @distance: (out): return location for the distance
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
|
|
|
|
* If both events have X/Y information, the distance between both coordinates
|
|
|
|
|
* (as in a straight line going from @event1 to @event2) will be returned.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the distance could be calculated.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_events_get_distance (GdkEvent *event1,
|
|
|
|
|
GdkEvent *event2,
|
|
|
|
|
gdouble *distance)
|
|
|
|
|
{
|
|
|
|
|
return gdk_events_get_axis_distances (event1, event2,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
distance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_events_get_angle:
|
|
|
|
|
* @event1: first #GdkEvent
|
|
|
|
|
* @event2: second #GdkEvent
|
2011-01-18 09:10:30 +00:00
|
|
|
|
* @angle: (out): return location for the relative angle between both events
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
|
|
|
|
* If both events contain X/Y information, this function will return %TRUE
|
|
|
|
|
* and return in @angle the relative angle from @event1 to @event2. The rotation
|
|
|
|
|
* direction for positive angles is from the positive X axis towards the positive
|
|
|
|
|
* Y axis.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the angle could be calculated.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_events_get_angle (GdkEvent *event1,
|
|
|
|
|
GdkEvent *event2,
|
|
|
|
|
gdouble *angle)
|
|
|
|
|
{
|
|
|
|
|
gdouble x_distance, y_distance, distance;
|
|
|
|
|
|
|
|
|
|
if (!gdk_events_get_axis_distances (event1, event2,
|
|
|
|
|
&x_distance, &y_distance,
|
|
|
|
|
&distance))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (angle)
|
|
|
|
|
{
|
|
|
|
|
*angle = atan2 (x_distance, y_distance);
|
|
|
|
|
|
|
|
|
|
/* Invert angle */
|
|
|
|
|
*angle = (2 * G_PI) - *angle;
|
|
|
|
|
|
|
|
|
|
/* Shift it 90° */
|
|
|
|
|
*angle += G_PI / 2;
|
|
|
|
|
|
|
|
|
|
/* And constraint it to 0°-360° */
|
|
|
|
|
*angle = fmod (*angle, 2 * G_PI);
|
2009-01-23 12:04:44 +00:00
|
|
|
|
}
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_events_get_center:
|
|
|
|
|
* @event1: first #GdkEvent
|
|
|
|
|
* @event2: second #GdkEvent
|
2010-06-07 21:47:14 +00:00
|
|
|
|
* @x: (out): return location for the X coordinate of the center
|
|
|
|
|
* @y: (out): return location for the Y coordinate of the center
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
|
|
|
|
* If both events contain X/Y information, the center of both coordinates
|
|
|
|
|
* will be returned in @x and @y.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the center could be calculated.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_events_get_center (GdkEvent *event1,
|
|
|
|
|
GdkEvent *event2,
|
|
|
|
|
gdouble *x,
|
|
|
|
|
gdouble *y)
|
|
|
|
|
{
|
|
|
|
|
gdouble x1, x2, y1, y2;
|
|
|
|
|
|
|
|
|
|
if (!gdk_event_get_coords (event1, &x1, &y1) ||
|
|
|
|
|
!gdk_event_get_coords (event2, &x2, &y2))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (x)
|
|
|
|
|
*x = (x2 + x1) / 2;
|
|
|
|
|
|
|
|
|
|
if (y)
|
|
|
|
|
*y = (y2 + y1) / 2;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
2007-02-06 14:53:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-26 15:59:38 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_set_display:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @display: a #GdkDisplay
|
|
|
|
|
*
|
|
|
|
|
* Sets the display that an event is associated with.
|
|
|
|
|
*/
|
2017-10-31 01:49:30 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_event_set_display (GdkEvent *event,
|
|
|
|
|
GdkDisplay *display)
|
|
|
|
|
{
|
2017-10-25 12:06:20 +00:00
|
|
|
|
event->any.display = display;
|
2017-10-31 01:49:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 19:07:02 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_display:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Retrieves the #GdkDisplay associated to the @event.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer none) (nullable): a #GdkDisplay
|
|
|
|
|
*/
|
2017-10-31 01:49:30 +00:00
|
|
|
|
GdkDisplay *
|
|
|
|
|
gdk_event_get_display (const GdkEvent *event)
|
2002-10-02 21:39:09 +00:00
|
|
|
|
{
|
2017-10-25 12:06:20 +00:00
|
|
|
|
if (event->any.display)
|
|
|
|
|
return event->any.display;
|
2002-10-02 21:39:09 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (event->any.surface)
|
|
|
|
|
return gdk_surface_get_display (event->any.surface);
|
2002-10-02 21:39:09 +00:00
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2011-03-01 07:36:54 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_event_sequence:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* If @event if of type %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE,
|
|
|
|
|
* %GDK_TOUCH_END or %GDK_TOUCH_CANCEL, returns the #GdkEventSequence
|
|
|
|
|
* to which the event belongs. Otherwise, return %NULL.
|
|
|
|
|
*
|
2014-05-20 12:07:16 +00:00
|
|
|
|
* Returns: (transfer none): the event sequence that the event belongs to
|
2011-03-01 07:36:54 +00:00
|
|
|
|
*/
|
|
|
|
|
GdkEventSequence *
|
|
|
|
|
gdk_event_get_event_sequence (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_TOUCH_BEGIN ||
|
|
|
|
|
event->any.type == GDK_TOUCH_UPDATE ||
|
|
|
|
|
event->any.type == GDK_TOUCH_END ||
|
|
|
|
|
event->any.type == GDK_TOUCH_CANCEL)
|
2011-02-28 19:53:42 +00:00
|
|
|
|
return event->touch.sequence;
|
|
|
|
|
|
2011-03-01 07:36:54 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_set_show_events:
|
|
|
|
|
* @show_events: %TRUE to output event debugging information.
|
|
|
|
|
*
|
|
|
|
|
* Sets whether a trace of received events is output.
|
|
|
|
|
* Note that GTK+ must be compiled with debugging (that is,
|
2014-02-04 22:48:33 +00:00
|
|
|
|
* configured using the `--enable-debug` option)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* to use this option.
|
|
|
|
|
**/
|
1998-12-15 13:54:20 +00:00
|
|
|
|
void
|
2000-03-14 19:57:25 +00:00
|
|
|
|
gdk_set_show_events (gboolean show_events)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
|
|
|
|
if (show_events)
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
_gdk_debug_flags |= GDK_DEBUG_EVENTS;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
else
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
_gdk_debug_flags &= ~GDK_DEBUG_EVENTS;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_get_show_events:
|
|
|
|
|
*
|
2002-04-26 14:34:42 +00:00
|
|
|
|
* Gets whether event debugging output is enabled.
|
2002-04-25 22:29:14 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if event debugging output is enabled.
|
2002-04-25 22:29:14 +00:00
|
|
|
|
**/
|
2000-03-14 19:57:25 +00:00
|
|
|
|
gboolean
|
1998-12-15 13:54:20 +00:00
|
|
|
|
gdk_get_show_events (void)
|
|
|
|
|
{
|
Make gdkx.h the only installed header from gdk/x11. All structures in
Fri Sep 7 11:51:44 2001 Owen Taylor <otaylor@redhat.com>
Make gdkx.h the only installed header from gdk/x11.
All structures in gdk/x11 are opaque.
* gdk/x11/Makefile.am gdk/x11/gdkx.h gdk/x11/gdkprivate-x11.h:
Don't install gdk{drawable,pixmap,window}-x11.h.
* gdk/x11/{gdkcolormap-x11.c, gdkfont-x11.c, gdkx.h, gdkvisual-x11.c:
Move GdkColormapPrivateX11, GdkFontPrivateX GdkImagePrivateX11,
GdkVisualClass into C files.
* gdk/gdkpixmap-x11.[ch]: Make gdk_pixmap_impl_get_type() static.
* gdk/x11/{gdkcolor-x11.c, gdkcursor-x11.c, gdkdrawable-x11.c,
gdkfont-x11.c, gdkgc-x11.c, gdkx.h, gdkimage-x11,gdkvisual-x11.c}
Add public functions to replace previously exported direct
structure access.
gdk_x11_colormap_get_{xdisplay,xcolormap}
gdk_x11_cursor_get_{xdisplay,xcursor},
gdk_x11_drawable_get_{xdisplay,xcursor,gdk_x11_visual_get_xvisual,
gdk_x11_font_get_{xdisplay,xfont}, gdk_x11_image_get_{xdisplay,ximage},
gdk_x11_gc_get_{xdisplay,ximage}
* gdk/gdkprivate.h gdk/gdkinternals.h: Move GdkColorInfo,
GdkEventFilter, GdkClientFilter, GdkFontPrivate to gdkinternals.
Fix a number of variables and functions that were exported
"accidentally" from GDK.
* gdk/**.[ch]: gdk => _gdk for gdk_visual_init,
gdk_events_init, gdk_input_init, gdk_dnd_init, gdk_image_exit,
gdk_input_exit, gdk_windowing_exit, gdk_event_func, gdk_event_data,
gdk_event_notify, gdk_queued_events, gdk_queued_tail,
gdk_event_new, gdk_events_queue, gdk_events_unqueue,
gdk_event_queue_find_first, gdk_event_queue_remove_link,
gdk_event_queue_append, gdk_event_button_generate,
gdk_debug_flags, gdk_default_filters, gdk_parent_root.
* gdk/x11/{gdkevents-x11.c, gdkglobals-x11.c, gdkimage-x11.c,
gdkmain-x11.c, gdkprivate-x11.h, gdk/x11/gdkwindow-x11.c}:
gdk => _gdk for gdk_event_mask_table, gkd_nevent_masks,
gdk_wm_window_protocols, gdk_leader_window, gdk_xgrab_window,
gdk_use_xshm, gdk_input_ignore_core.
* gdk/x11/xsettings-common.h (xsettings_list_insert): Add
#defines to namespace functions into the private _gdk_
namespace.
* gdk/gdkwindow.[ch] gdk/x11/gdkx.h: Add gdk_get_default_root_window ()
to replace gdk_parent_root exported variable. Adjust and
deprecate GDK_ROOT_PARENT().
* demos/{testpixbuf-drawable.c,testpixbuf-save.c}: Fix
GDK_ROOT_PARENT usage, remove includes of port-specific
headers.
* gdk/{win32,x11,fb}/gdkinput*.[ch]: s/gdk/_gdk/ for
_gdk_input_gxid_host, _gdk_input_gxid_port, _gdk_input_ignore_core,
gdk_input_devices, _gdk_input_windows, gdk_init_input_core.
* gdk/x11/{gdkevents-x11.,c gdkglobals-x11.c, gdkmain-x11.c}
docs/Changes-2.0.txt: Remove gdk_wm_protocols,
gdk_wm_delete_window functions, gdk_wm_take_focus,
use gdk_atom_intern() instead.
* gdk/linux-fb/{gdkselection-fb.c, gdkmain-fb.c, gdkprivatefb.h}
gdk/win32/{gdkselection-win32.c, gdkmgdkwin32.h, gdkprivate-win32.h}
gdk/x11/{gdkselection-x11.c gdkx.h, gtkprivate-x11.h}
gtk/gtkselection.c
Unexport gdk_selection_property, just use
gdk_atom_intern ("GDK_SELECTION").
* gdk/x11/{gdkprivate-x11.h,gdkdrawable-x11h,gdkgc-x11.c,gdkx.h}:
Unexport gdk_drawable_impl_x11_get_type, gdk_gc_x11_get_type,
GDK_GC_X11 cast macros, GdkGCX11 structures, GdkCursorPrivate,
GdkVisualprivate, gdk_x11_gc_flush.
Make a number of public exports of variables into functions
to increase encapsulation.
* gdk/gdkinternals.h gdk/gdkinput.h gdk/gdkevents.h
gdk/linux-fb/gdkmouse-fb.c: gdk_core_pointer => _gdk_core_pointer,
move to gdkinternals.h. Add gdk_device_get_core_pointer ().
* gdk/gdkprivate.h gdk/gdkpango.c gdk/gdkinternals.h
docs/Changes-2.0.txt: Unexport gdk_parent_root, gdk_error_code,
gdk_error_warnings.
* gdk/x11/{gdkcolormap-x11.c, gdkmain-x11.c, gdkx.h}
docs/Changes-2.0.txt:
s/gdk_screen/_gdk_screen/, add gdk_x11_get_default_screen()
s/gdk_root_window/_gdk_root_window/, add gdk_x11_get_default_root_xwindow()
Add gdk_x11_get_default_xdisplay().
* gdk/gdk.h gdk/gdk.c linux-fb/gdkfb.h linux-fb/gdkglobals-fb.c
win32/gdkwin32.h x11/gdkglobals-x11.c gdk/x11/gdkmain-x11.c
gdk/x11/gdkx.h: gdk/gdk.def: Add gdk_get/set_program_class,
Don't export gdk_progclass, move --class command line
option and handling to common portion of GDK.
Miscellaneous fixes:
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon_list): Fix
g_return_val_if_fail that should have been g_return_if_fail.
* gdk/gdkinternals.h gdk/gdkprivate.h: Move
gdk_synthesize_window_state() to the semi-public gdkprivate.h.
* gtk/gtkdnd.c (_gtk_drag_source_handle_event): Remove uneeded
X11 dependency.
* gdk/linux-fb/gdkmain-fb.c gdk/win32/gdkmain-win32.c gdk/TODO:
Remove unused gdk_key_repeat_disable/restore.
* linux-fb/gdkglobals-fb.c win32/gdkglobals-win32.c
x11/gdkglobals-x11.c x11/gdkprivate-x11.h gdk/gdk.def:
Remove unused gdk_null_window_warnings variable.
* gdk/Makefile.am (DIST_SUBDIRS) nanox/*: cvs remove nanox;
it can be retrieved from the repository; it is too far
from functional to be worth having people check out;
it would be easier to start from scratch, I suspect.
* gdk/x11/gdkpixmap-x11.c: Fix lvalue usage of GDK_PIXMAP_XID().
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
* gdk/x11/gdkkeys-x11.c gdk/gdkrgb.c gdk/gdkwindow.c
gdk/x11/gdkpango-x11.c gdk/x11/gdkselection-x11.c:
Fix some accidentally global variables and unused global variables.
Add some space for future expansion to multihead.
* gdk/gdkdrawable.h: Add four reserved function pointers
for future expansion of GdkDrawableClass.
* gtk/gtkwindow.h gtk/gtkinvisible.h: Add reserved pointer
where we can put a GdkScreen * later.
2001-09-07 21:50:20 +00:00
|
|
|
|
return (_gdk_debug_flags & GDK_DEBUG_EVENTS) != 0;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-20 12:07:16 +00:00
|
|
|
|
static GdkEventSequence *
|
|
|
|
|
gdk_event_sequence_copy (GdkEventSequence *sequence)
|
|
|
|
|
{
|
|
|
|
|
return sequence;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_event_sequence_free (GdkEventSequence *sequence)
|
|
|
|
|
{
|
|
|
|
|
/* Nothing to free here */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
G_DEFINE_BOXED_TYPE (GdkEventSequence, gdk_event_sequence,
|
|
|
|
|
gdk_event_sequence_copy,
|
|
|
|
|
gdk_event_sequence_free)
|
|
|
|
|
|
2013-08-13 23:06:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_event_type:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Retrieves the type of the event.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: a #GdkEventType
|
2013-08-13 23:06:48 +00:00
|
|
|
|
*/
|
|
|
|
|
GdkEventType
|
|
|
|
|
gdk_event_get_event_type (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, GDK_NOTHING);
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
return event->any.type;
|
2013-08-13 23:06:48 +00:00
|
|
|
|
}
|
2015-11-26 18:53:09 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_seat:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Returns the #GdkSeat this event was generated for.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer none): The #GdkSeat of this event
|
|
|
|
|
**/
|
|
|
|
|
GdkSeat *
|
|
|
|
|
gdk_event_get_seat (const GdkEvent *event)
|
|
|
|
|
{
|
2017-10-25 11:50:55 +00:00
|
|
|
|
GdkDevice *device;
|
2015-11-26 18:53:09 +00:00
|
|
|
|
|
2017-10-25 11:50:55 +00:00
|
|
|
|
device = gdk_event_get_device (event);
|
2015-12-16 18:00:39 +00:00
|
|
|
|
|
2017-10-25 11:50:55 +00:00
|
|
|
|
return device ? gdk_device_get_seat (device) : NULL;
|
2015-11-26 18:53:09 +00:00
|
|
|
|
}
|
2015-01-06 13:52:42 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_device_tool:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* If the event was generated by a device that supports
|
|
|
|
|
* different tools (eg. a tablet), this function will
|
|
|
|
|
* return a #GdkDeviceTool representing the tool that
|
|
|
|
|
* caused the event. Otherwise, %NULL will be returned.
|
|
|
|
|
*
|
|
|
|
|
* Note: the #GdkDeviceTool<!-- -->s will be constant during
|
|
|
|
|
* the application lifetime, if settings must be stored
|
|
|
|
|
* persistently across runs, see gdk_device_tool_get_serial()
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer none): The current device tool, or %NULL
|
|
|
|
|
**/
|
|
|
|
|
GdkDeviceTool *
|
|
|
|
|
gdk_event_get_device_tool (const GdkEvent *event)
|
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (event->any.type == GDK_BUTTON_PRESS ||
|
|
|
|
|
event->any.type == GDK_BUTTON_RELEASE)
|
|
|
|
|
return event->button.tool;
|
|
|
|
|
else if (event->any.type == GDK_MOTION_NOTIFY)
|
|
|
|
|
return event->motion.tool;
|
2015-01-06 13:52:42 +00:00
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
return NULL;
|
2015-01-06 13:52:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_set_device_tool:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @tool: (nullable): tool to set on the event, or %NULL
|
|
|
|
|
*
|
|
|
|
|
* Sets the device tool for this event, should be rarely used.
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_device_tool (GdkEvent *event,
|
|
|
|
|
GdkDeviceTool *tool)
|
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (event->any.type == GDK_BUTTON_PRESS ||
|
|
|
|
|
event->any.type == GDK_BUTTON_RELEASE)
|
2017-10-31 11:21:29 +00:00
|
|
|
|
g_set_object (&event->button.tool, tool);
|
2017-10-11 06:42:41 +00:00
|
|
|
|
else if (event->any.type == GDK_MOTION_NOTIFY)
|
2017-10-31 11:21:29 +00:00
|
|
|
|
g_set_object (&event->motion.tool, tool);
|
2015-01-06 13:52:42 +00:00
|
|
|
|
}
|
2016-04-21 13:30:58 +00:00
|
|
|
|
|
|
|
|
|
void
|
2016-05-10 19:31:29 +00:00
|
|
|
|
gdk_event_set_scancode (GdkEvent *event,
|
|
|
|
|
guint16 scancode)
|
2016-04-21 13:30:58 +00:00
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (event->any.type == GDK_KEY_PRESS ||
|
|
|
|
|
event->any.type == GDK_KEY_RELEASE)
|
|
|
|
|
event->key.key_scancode = scancode;
|
2016-04-21 13:30:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_scancode:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
2016-04-22 02:55:57 +00:00
|
|
|
|
* Gets the keyboard low-level scancode of a key event.
|
|
|
|
|
*
|
|
|
|
|
* This is usually hardware_keycode. On Windows this is the high
|
|
|
|
|
* word of WM_KEY{DOWN,UP} lParam which contains the scancode and
|
|
|
|
|
* some extended flags.
|
2016-04-21 13:30:58 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns: The associated keyboard scancode or 0
|
|
|
|
|
**/
|
|
|
|
|
int
|
|
|
|
|
gdk_event_get_scancode (GdkEvent *event)
|
|
|
|
|
{
|
2017-10-11 06:42:41 +00:00
|
|
|
|
if (event->any.type == GDK_KEY_PRESS ||
|
|
|
|
|
event->any.type == GDK_KEY_RELEASE)
|
|
|
|
|
return event->key.key_scancode;
|
2016-04-21 13:30:58 +00:00
|
|
|
|
|
2017-10-11 06:42:41 +00:00
|
|
|
|
return 0;
|
2016-04-21 13:30:58 +00:00
|
|
|
|
}
|
2017-05-04 11:41:29 +00:00
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_user_data (GdkEvent *event,
|
|
|
|
|
GObject *user_data)
|
|
|
|
|
{
|
2017-10-25 11:23:41 +00:00
|
|
|
|
if (user_data)
|
|
|
|
|
{
|
|
|
|
|
g_object_set_qdata_full (G_OBJECT (event), quark_event_user_data,
|
|
|
|
|
g_object_ref (user_data),
|
|
|
|
|
g_object_unref);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_object_steal_qdata (G_OBJECT (event), quark_event_user_data);
|
|
|
|
|
}
|
2017-05-04 11:41:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GObject *
|
2017-05-10 16:03:10 +00:00
|
|
|
|
gdk_event_get_user_data (const GdkEvent *event)
|
2017-05-04 11:41:29 +00:00
|
|
|
|
{
|
2017-10-25 11:23:41 +00:00
|
|
|
|
return g_object_get_qdata (G_OBJECT (event), quark_event_user_data);
|
2017-05-04 11:41:29 +00:00
|
|
|
|
}
|
2017-08-26 02:50:52 +00:00
|
|
|
|
|
2017-12-26 15:30:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_is_sent:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Returns whether the event was sent explicitly.
|
|
|
|
|
*
|
|
|
|
|
* Returns: %TRUE if the event was sent explicitly
|
|
|
|
|
*/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_is_sent (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return event->any.send_event;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_drag_context:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @context: (out) (transfer none): return location for the drag context
|
|
|
|
|
*
|
|
|
|
|
* Gets the drag context from a DND event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_drag_context (const GdkEvent *event,
|
|
|
|
|
GdkDragContext **context)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_DRAG_ENTER ||
|
|
|
|
|
event->any.type == GDK_DRAG_LEAVE ||
|
|
|
|
|
event->any.type == GDK_DRAG_MOTION ||
|
2017-12-15 21:54:34 +00:00
|
|
|
|
event->any.type == GDK_DROP_START)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
*context = event->dnd.context;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_crossing_mode:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @mode: (out): return location for the crossing mode
|
|
|
|
|
*
|
|
|
|
|
* Extracts the crossing mode from an event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_crossing_mode (const GdkEvent *event,
|
|
|
|
|
GdkCrossingMode *mode)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_ENTER_NOTIFY ||
|
|
|
|
|
event->any.type == GDK_LEAVE_NOTIFY)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
*mode = event->crossing.mode;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_crossing_detail:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @detail: (out): return location for the crossing detail
|
|
|
|
|
*
|
|
|
|
|
* Extracts the crossing detail from an event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_crossing_detail (const GdkEvent *event,
|
|
|
|
|
GdkNotifyType *detail)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_ENTER_NOTIFY ||
|
|
|
|
|
event->any.type == GDK_LEAVE_NOTIFY)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
*detail = event->crossing.detail;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_touchpad_gesture_phase:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @phase: (out): Return location for the gesture phase
|
|
|
|
|
*
|
|
|
|
|
* Extracts the touchpad gesture phase from a touchpad event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_touchpad_gesture_phase (const GdkEvent *event,
|
|
|
|
|
GdkTouchpadGesturePhase *phase)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_TOUCHPAD_PINCH)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
*phase = event->touchpad_pinch.phase;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_TOUCHPAD_SWIPE)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
*phase = event->touchpad_swipe.phase;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_touchpad_gesture_n_fingers:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @n_fingers: (out): return location for the number of fingers
|
|
|
|
|
*
|
|
|
|
|
* Extracts the number of fingers from a touchpad event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 02:50:52 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_touchpad_gesture_n_fingers (const GdkEvent *event,
|
|
|
|
|
guint *n_fingers)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_TOUCHPAD_PINCH)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
*n_fingers = event->touchpad_pinch.n_fingers;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_TOUCHPAD_SWIPE)
|
2017-08-26 02:50:52 +00:00
|
|
|
|
{
|
|
|
|
|
*n_fingers = event->touchpad_swipe.n_fingers;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2017-08-26 14:50:15 +00:00
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_touchpad_deltas:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @dx: (out): return location for x
|
|
|
|
|
* @dy: (out): return location for y
|
|
|
|
|
*
|
|
|
|
|
* Extracts delta information from a touchpad event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_touchpad_deltas (const GdkEvent *event,
|
|
|
|
|
double *dx,
|
|
|
|
|
double *dy)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_TOUCHPAD_PINCH)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*dx = event->touchpad_pinch.dx;
|
|
|
|
|
*dy = event->touchpad_pinch.dy;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_TOUCHPAD_SWIPE)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*dx = event->touchpad_swipe.dx;
|
|
|
|
|
*dy = event->touchpad_swipe.dy;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_touchpad_angle_delta:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @delta: (out): Return location for angle
|
|
|
|
|
*
|
|
|
|
|
* Extracts the angle from a touchpad event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_touchpad_angle_delta (const GdkEvent *event,
|
|
|
|
|
double *delta)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_TOUCHPAD_PINCH)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*delta = event->touchpad_pinch.angle_delta;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_touchpad_scale:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @scale: (out): Return location for scale
|
|
|
|
|
*
|
|
|
|
|
* Extracts the scale from a touchpad event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_touchpad_scale (const GdkEvent *event,
|
|
|
|
|
double *scale)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_TOUCHPAD_PINCH)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*scale = event->touchpad_pinch.scale;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_touch_emulating_pointer:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @emulating: (out): Return location for information
|
|
|
|
|
*
|
|
|
|
|
* Extracts whether a touch event is emulating a pointer event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_touch_emulating_pointer (const GdkEvent *event,
|
|
|
|
|
gboolean *emulating)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_TOUCH_BEGIN ||
|
|
|
|
|
event->any.type == GDK_TOUCH_UPDATE ||
|
|
|
|
|
event->any.type == GDK_TOUCH_END)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*emulating = event->touch.emulating_pointer;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* gdk_event_get_grab_surface:
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* @event: a #GdkEvent
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (out) (transfer none): Return location for the grab surface
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Extracts the grab surface from a grab broken event.
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_event_get_grab_surface (const GdkEvent *event,
|
|
|
|
|
GdkSurface **surface)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_GRAB_BROKEN)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
*surface = event->grab_broken.grab_surface;
|
2017-08-26 14:50:15 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_focus_in:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @focus_in: (out): return location for focus direction
|
|
|
|
|
*
|
|
|
|
|
* Extracts whether this is a focus-in or focus-out event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_focus_in (const GdkEvent *event,
|
|
|
|
|
gboolean *focus_in)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_FOCUS_CHANGE)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*focus_in = event->focus_change.in;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_pad_group_mode:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @group: (out): return location for the group
|
|
|
|
|
* @mode: (out): return location for the mode
|
|
|
|
|
*
|
|
|
|
|
* Extracts group and mode information from a pad event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_pad_group_mode (const GdkEvent *event,
|
|
|
|
|
guint *group,
|
|
|
|
|
guint *mode)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_PAD_GROUP_MODE)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*group = event->pad_group_mode.group;
|
|
|
|
|
*mode = event->pad_group_mode.mode;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_PAD_BUTTON_PRESS ||
|
|
|
|
|
event->any.type == GDK_PAD_BUTTON_RELEASE)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*group = event->pad_button.group;
|
|
|
|
|
*mode = event->pad_button.mode;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_PAD_RING ||
|
|
|
|
|
event->any.type == GDK_PAD_STRIP)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*group = event->pad_axis.group;
|
|
|
|
|
*mode = event->pad_axis.mode;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_pad_button:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @button: (out): Return location for the button
|
|
|
|
|
*
|
|
|
|
|
* Extracts information about the pressed button from
|
|
|
|
|
* a pad event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_pad_button (const GdkEvent *event,
|
|
|
|
|
guint *button)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_PAD_BUTTON_PRESS ||
|
|
|
|
|
event->any.type == GDK_PAD_BUTTON_RELEASE)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*button = event->pad_button.button;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_pad_axis_value:
|
|
|
|
|
* @event: a #GdkEvent
|
2017-12-26 15:59:38 +00:00
|
|
|
|
* @index: (out): Return location for the axis index
|
|
|
|
|
* @value: (out): Return location for the axis value
|
|
|
|
|
*
|
|
|
|
|
* Extracts the information from a pad event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-26 14:50:15 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_pad_axis_value (const GdkEvent *event,
|
|
|
|
|
guint *index,
|
|
|
|
|
gdouble *value)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_PAD_RING ||
|
|
|
|
|
event->any.type == GDK_PAD_STRIP)
|
2017-08-26 14:50:15 +00:00
|
|
|
|
{
|
|
|
|
|
*index = event->pad_axis.index;
|
|
|
|
|
*value = event->pad_axis.value;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-21 12:07:11 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_axes:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @axes: (transfer none) (out) (array length=n_axes): the array of values for all axes
|
|
|
|
|
* @n_axes: (out): the length of array
|
2017-12-26 15:59:38 +00:00
|
|
|
|
*
|
|
|
|
|
* Extracts all axis values from an event.
|
|
|
|
|
*
|
2017-09-21 12:07:11 +00:00
|
|
|
|
* Returns: %TRUE on success, otherwise %FALSE
|
|
|
|
|
**/
|
2017-08-28 22:47:35 +00:00
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_axes (GdkEvent *event,
|
|
|
|
|
gdouble **axes,
|
|
|
|
|
guint *n_axes)
|
|
|
|
|
{
|
|
|
|
|
GdkDevice *source_device;
|
|
|
|
|
|
|
|
|
|
if (!event)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
source_device = gdk_event_get_source_device (event);
|
|
|
|
|
|
|
|
|
|
if (!source_device)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
2017-10-11 13:55:19 +00:00
|
|
|
|
if (event->any.type == GDK_MOTION_NOTIFY)
|
2017-08-28 22:47:35 +00:00
|
|
|
|
{
|
|
|
|
|
*axes = event->motion.axes;
|
|
|
|
|
*n_axes = gdk_device_get_n_axes (source_device);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2017-10-11 13:55:19 +00:00
|
|
|
|
else if (event->any.type == GDK_BUTTON_PRESS ||
|
|
|
|
|
event->any.type == GDK_BUTTON_RELEASE)
|
2017-08-28 22:47:35 +00:00
|
|
|
|
{
|
|
|
|
|
*axes = event->button.axes;
|
|
|
|
|
*n_axes = gdk_device_get_n_axes (source_device);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-21 19:07:02 +00:00
|
|
|
|
/**
|
2018-02-05 14:59:40 +00:00
|
|
|
|
* gdk_event_get_motion_history:
|
2017-12-21 19:07:02 +00:00
|
|
|
|
* @event: a #GdkEvent of type %GDK_MOTION_NOTIFY
|
|
|
|
|
*
|
|
|
|
|
* Retrieves the history of the @event motion, as a list of time and
|
|
|
|
|
* coordinates.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer container) (element-type GdkTimeCoord) (nullable): a list
|
|
|
|
|
* of time and coordinates
|
2018-02-05 14:59:40 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 3.94
|
2017-12-21 19:07:02 +00:00
|
|
|
|
*/
|
2017-10-31 11:37:50 +00:00
|
|
|
|
GList *
|
2018-02-05 14:59:40 +00:00
|
|
|
|
gdk_event_get_motion_history (const GdkEvent *event)
|
2017-10-31 11:37:50 +00:00
|
|
|
|
{
|
|
|
|
|
if (event->any.type != GDK_MOTION_NOTIFY)
|
|
|
|
|
return NULL;
|
|
|
|
|
return g_list_reverse (g_list_copy (event->motion.history));
|
|
|
|
|
}
|