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
|
|
|
|
|
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"
|
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
|
|
|
|
|
* gtk_main_do_event() and passed on to the appropriate widgets, so these
|
|
|
|
|
* functions are rarely needed. Though some of the fields in the
|
2014-02-07 02:07:03 +00:00
|
|
|
|
* [Event Structures][gdk3-Event-Structures] are useful.
|
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;
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
1999-01-21 06:24:09 +00:00
|
|
|
|
GdkEventPrivate *event = tmp_list->data;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
2013-11-11 23:04:34 +00:00
|
|
|
|
if ((event->flags & GDK_EVENT_PENDING) == 0 &&
|
|
|
|
|
(!paused || (event->flags & GDK_EVENT_FLUSHED) != 0))
|
2013-09-28 16:06:53 +00:00
|
|
|
|
{
|
|
|
|
|
if (pending_motion)
|
|
|
|
|
return pending_motion;
|
|
|
|
|
|
2013-11-11 23:04:34 +00:00
|
|
|
|
if (event->event.type == GDK_MOTION_NOTIFY && (event->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.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.16
|
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
*
|
|
|
|
|
* Since: 2.16
|
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2012-09-26 14:28:06 +00:00
|
|
|
|
void
|
|
|
|
|
_gdk_event_queue_handle_motion_compression (GdkDisplay *display)
|
|
|
|
|
{
|
|
|
|
|
GList *tmp_list;
|
|
|
|
|
GList *pending_motions = NULL;
|
|
|
|
|
GdkWindow *pending_motion_window = NULL;
|
2013-02-14 19:51:33 +00:00
|
|
|
|
GdkDevice *pending_motion_device = NULL;
|
2012-09-26 14:28:06 +00:00
|
|
|
|
|
|
|
|
|
/* If the last N events in the event queue are motion notify
|
|
|
|
|
* events for the same window, drop all but the last */
|
|
|
|
|
|
|
|
|
|
tmp_list = display->queued_tail;
|
|
|
|
|
|
|
|
|
|
while (tmp_list)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *event = tmp_list->data;
|
|
|
|
|
|
|
|
|
|
if (event->flags & GDK_EVENT_PENDING)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (event->event.type != GDK_MOTION_NOTIFY)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (pending_motion_window != NULL &&
|
|
|
|
|
pending_motion_window != event->event.motion.window)
|
|
|
|
|
break;
|
|
|
|
|
|
2013-02-14 19:51:33 +00:00
|
|
|
|
if (pending_motion_device != NULL &&
|
|
|
|
|
pending_motion_device != event->event.motion.device)
|
|
|
|
|
break;
|
|
|
|
|
|
2013-10-29 21:43:05 +00:00
|
|
|
|
if (!event->event.motion.window->event_compression)
|
|
|
|
|
break;
|
|
|
|
|
|
2012-09-26 14:28:06 +00:00
|
|
|
|
pending_motion_window = event->event.motion.window;
|
2013-02-14 19:51:33 +00:00
|
|
|
|
pending_motion_device = event->event.motion.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;
|
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)
|
|
|
|
|
{
|
|
|
|
|
GdkFrameClock *clock = gdk_window_get_frame_clock (pending_motion_window);
|
2013-11-11 23:17:38 +00:00
|
|
|
|
if (clock) /* might be NULL if window was destroyed */
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *event = tmp_list->data;
|
|
|
|
|
event->flags |= GDK_EVENT_FLUSHED;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2010-12-11 00:42:09 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_events_pending:
|
|
|
|
|
*
|
|
|
|
|
* Checks if any events are ready to be processed for any display.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if any events are pending.
|
2010-12-11 00:42:09 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_events_pending (void)
|
|
|
|
|
{
|
|
|
|
|
GSList *list, *l;
|
|
|
|
|
gboolean pending;
|
|
|
|
|
|
|
|
|
|
pending = FALSE;
|
|
|
|
|
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
|
|
|
|
for (l = list; l; l = l->next)
|
|
|
|
|
{
|
|
|
|
|
if (_gdk_event_queue_find_first (l->data))
|
|
|
|
|
{
|
|
|
|
|
pending = TRUE;
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (l = list; l; l = l->next)
|
|
|
|
|
{
|
|
|
|
|
if (gdk_display_has_pending (l->data))
|
|
|
|
|
{
|
|
|
|
|
pending = TRUE;
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
out:
|
|
|
|
|
g_slist_free (list);
|
|
|
|
|
|
|
|
|
|
return pending;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get:
|
|
|
|
|
*
|
|
|
|
|
* Checks all open displays for a #GdkEvent to process,to be processed
|
|
|
|
|
* on, fetching events from the windowing system if necessary.
|
|
|
|
|
* See gdk_display_get_event().
|
|
|
|
|
*
|
2014-05-08 19:55:50 +00:00
|
|
|
|
* Returns: (nullable): the next #GdkEvent to be processed, or %NULL
|
|
|
|
|
* if no events are pending. The returned #GdkEvent should be freed
|
|
|
|
|
* with gdk_event_free().
|
2002-04-25 22:29:14 +00:00
|
|
|
|
**/
|
1999-02-10 08:06:30 +00:00
|
|
|
|
GdkEvent*
|
1998-12-15 13:54:20 +00:00
|
|
|
|
gdk_event_get (void)
|
|
|
|
|
{
|
2010-12-11 00:42:09 +00:00
|
|
|
|
GSList *list, *l;
|
|
|
|
|
GdkEvent *event;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
2010-12-11 00:42:09 +00:00
|
|
|
|
event = NULL;
|
|
|
|
|
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
|
|
|
|
for (l = list; l; l = l->next)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
{
|
2010-12-11 00:42:09 +00:00
|
|
|
|
event = gdk_display_get_event (l->data);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
if (event)
|
2010-12-11 00:42:09 +00:00
|
|
|
|
break;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-11 00:42:09 +00:00
|
|
|
|
g_slist_free (list);
|
|
|
|
|
|
|
|
|
|
return event;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_peek:
|
1999-01-12 23:27:30 +00:00
|
|
|
|
*
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* If there is an event waiting in the event queue of some open
|
|
|
|
|
* display, returns a copy of it. See gdk_display_peek_event().
|
|
|
|
|
*
|
2014-05-08 19:55:50 +00:00
|
|
|
|
* Returns: (nullable): a copy of the first #GdkEvent on some event
|
|
|
|
|
* queue, or %NULL if no events are in any queues. The returned
|
|
|
|
|
* #GdkEvent should be freed with gdk_event_free().
|
2002-04-25 22:29:14 +00:00
|
|
|
|
**/
|
1999-02-10 08:06:30 +00:00
|
|
|
|
GdkEvent*
|
1999-01-12 23:27:30 +00:00
|
|
|
|
gdk_event_peek (void)
|
|
|
|
|
{
|
2010-12-11 00:42:09 +00:00
|
|
|
|
GSList *list, *l;
|
|
|
|
|
GdkEvent *event;
|
1999-01-12 23:27:30 +00:00
|
|
|
|
|
2010-12-11 00:42:09 +00:00
|
|
|
|
event = NULL;
|
|
|
|
|
list = gdk_display_manager_list_displays (gdk_display_manager_get ());
|
|
|
|
|
for (l = list; l; l = l->next)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
{
|
2010-12-11 00:42:09 +00:00
|
|
|
|
event = gdk_display_peek_event (l->data);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
if (event)
|
2010-12-11 00:42:09 +00:00
|
|
|
|
break;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-11 00:42:09 +00:00
|
|
|
|
g_slist_free (list);
|
|
|
|
|
|
|
|
|
|
return event;
|
1999-01-12 23:27:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-10-28 05:29:29 +00:00
|
|
|
|
static GdkDisplay *
|
|
|
|
|
event_get_display (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->any.window)
|
|
|
|
|
return gdk_window_get_display (event->any.window);
|
|
|
|
|
else
|
|
|
|
|
return gdk_display_get_default ();
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_put:
|
|
|
|
|
* @event: a #GdkEvent.
|
|
|
|
|
*
|
|
|
|
|
* Appends a copy of the given event onto the front of the event
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* queue for event->any.window’s display, or the default event
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* queue if event->any.window is %NULL. See gdk_display_put_event().
|
|
|
|
|
**/
|
1998-12-15 13:54:20 +00:00
|
|
|
|
void
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_put (const GdkEvent *event)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
GdkDisplay *display;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (event != NULL);
|
1998-12-15 15:32:49 +00:00
|
|
|
|
|
2014-10-28 05:29:29 +00:00
|
|
|
|
display = event_get_display (event);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_display_put_event (display, event);
|
|
|
|
|
}
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
2002-10-02 21:39:09 +00:00
|
|
|
|
static GHashTable *event_hash = NULL;
|
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.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: a newly-allocated #GdkEvent. The returned #GdkEvent
|
2002-10-22 22:11:22 +00:00
|
|
|
|
* should be freed with gdk_event_free().
|
2002-11-28 00:33:17 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.2
|
2002-10-22 22:11:22 +00:00
|
|
|
|
**/
|
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
|
|
|
|
{
|
2002-10-03 20:53:30 +00:00
|
|
|
|
GdkEventPrivate *new_private;
|
|
|
|
|
GdkEvent *new_event;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
2005-12-06 10:40:09 +00:00
|
|
|
|
if (!event_hash)
|
|
|
|
|
event_hash = g_hash_table_new (g_direct_hash, NULL);
|
|
|
|
|
|
2005-12-05 20:51:18 +00:00
|
|
|
|
new_private = g_slice_new0 (GdkEventPrivate);
|
2002-10-03 20:53:30 +00:00
|
|
|
|
|
|
|
|
|
new_private->flags = 0;
|
|
|
|
|
new_private->screen = NULL;
|
|
|
|
|
|
|
|
|
|
g_hash_table_insert (event_hash, new_private, GUINT_TO_POINTER (1));
|
|
|
|
|
|
|
|
|
|
new_event = (GdkEvent *) new_private;
|
|
|
|
|
|
|
|
|
|
new_event->any.type = type;
|
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.
|
|
|
|
|
*/
|
|
|
|
|
switch (type)
|
|
|
|
|
{
|
|
|
|
|
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_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_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;
|
|
|
|
|
}
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
2002-10-03 20:53:30 +00:00
|
|
|
|
return new_event;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-10-02 21:39:09 +00:00
|
|
|
|
static gboolean
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_is_allocated (const GdkEvent *event)
|
2002-10-02 21:39:09 +00:00
|
|
|
|
{
|
|
|
|
|
if (event_hash)
|
|
|
|
|
return g_hash_table_lookup (event_hash, event) != NULL;
|
2002-10-02 22:30:37 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
2002-10-02 21:39:09 +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
|
|
|
|
{
|
|
|
|
|
if (gdk_event_is_allocated (event))
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private = (GdkEventPrivate *) event;
|
|
|
|
|
|
|
|
|
|
if (emulated)
|
|
|
|
|
private->flags |= GDK_EVENT_POINTER_EMULATED;
|
|
|
|
|
else
|
|
|
|
|
private->flags &= ~(GDK_EVENT_POINTER_EMULATED);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-05-10 19:22:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_pointer_emulated:
|
|
|
|
|
* #event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
*/
|
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
|
|
|
|
{
|
|
|
|
|
if (gdk_event_is_allocated (event))
|
|
|
|
|
return (((GdkEventPrivate *) event)->flags & GDK_EVENT_POINTER_EMULATED) != 0;
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_copy:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Copies a #GdkEvent, copying or incrementing the reference count of the
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* resources associated with it (e.g. #GdkWindow’s and strings).
|
2002-04-25 22:29:14 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: a copy of @event. The returned #GdkEvent should be freed with
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* gdk_event_free().
|
|
|
|
|
**/
|
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
|
|
|
|
{
|
2002-10-03 20:53:30 +00:00
|
|
|
|
GdkEventPrivate *new_private;
|
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
|
|
|
|
|
2002-10-03 20:53:30 +00:00
|
|
|
|
new_event = gdk_event_new (GDK_NOTHING);
|
|
|
|
|
new_private = (GdkEventPrivate *)new_event;
|
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
*new_event = *event;
|
2000-11-01 15:55:48 +00:00
|
|
|
|
if (new_event->any.window)
|
2002-09-25 07:23:55 +00:00
|
|
|
|
g_object_ref (new_event->any.window);
|
2002-10-03 20:53:30 +00:00
|
|
|
|
|
2003-04-18 21:24:43 +00:00
|
|
|
|
if (gdk_event_is_allocated (event))
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private = (GdkEventPrivate *)event;
|
|
|
|
|
|
|
|
|
|
new_private->screen = private->screen;
|
2015-08-03 15:22:29 +00:00
|
|
|
|
new_private->device = private->device ? g_object_ref (private->device) : NULL;
|
|
|
|
|
new_private->source_device = private->source_device ? g_object_ref (private->source_device) : NULL;
|
2015-12-16 17:59:57 +00:00
|
|
|
|
new_private->seat = private->seat;
|
2015-01-06 13:52:42 +00:00
|
|
|
|
new_private->tool = private->tool;
|
2003-04-18 21:24:43 +00:00
|
|
|
|
}
|
2011-01-20 03:52:55 +00:00
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
switch (event->any.type)
|
|
|
|
|
{
|
|
|
|
|
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:
|
|
|
|
|
if (event->crossing.subwindow != NULL)
|
2011-01-20 03:52:55 +00:00
|
|
|
|
g_object_ref (event->crossing.subwindow);
|
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_DRAG_STATUS:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
case GDK_DROP_FINISHED:
|
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:
|
2009-12-19 18:51:12 +00:00
|
|
|
|
case GDK_DAMAGE:
|
2001-03-09 13:28:26 +00:00
|
|
|
|
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
|
|
|
|
|
2001-04-02 23:33:47 +00:00
|
|
|
|
case GDK_SETTING:
|
|
|
|
|
new_event->setting.name = g_strdup (new_event->setting.name);
|
|
|
|
|
break;
|
2003-02-18 20:14:56 +00:00
|
|
|
|
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
2011-02-24 16:38:40 +00:00
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2003-02-18 20:14:56 +00:00
|
|
|
|
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,
|
2010-11-23 19:25:13 +00:00
|
|
|
|
sizeof (gdouble) * gdk_device_get_n_axes (event->button.device));
|
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,
|
|
|
|
|
sizeof (gdouble) * gdk_device_get_n_axes (event->touch.device));
|
|
|
|
|
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,
|
|
|
|
|
sizeof (gdouble) * gdk_device_get_n_axes (event->motion.device));
|
2003-02-18 20:14:56 +00:00
|
|
|
|
break;
|
2010-11-23 19:25:13 +00:00
|
|
|
|
|
2011-01-31 05:43:18 +00:00
|
|
|
|
case GDK_OWNER_CHANGE:
|
2011-02-01 00:35:51 +00:00
|
|
|
|
new_event->owner_change.owner = event->owner_change.owner;
|
|
|
|
|
if (new_event->owner_change.owner)
|
|
|
|
|
g_object_ref (new_event->owner_change.owner);
|
2011-01-31 05:43:18 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2011-02-01 16:22:04 +00:00
|
|
|
|
case GDK_SELECTION_CLEAR:
|
|
|
|
|
case GDK_SELECTION_NOTIFY:
|
|
|
|
|
case GDK_SELECTION_REQUEST:
|
|
|
|
|
new_event->selection.requestor = event->selection.requestor;
|
|
|
|
|
if (new_event->selection.requestor)
|
2011-11-17 10:59:27 +00:00
|
|
|
|
g_object_ref (new_event->selection.requestor);
|
2011-02-01 16:22:04 +00:00
|
|
|
|
break;
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
if (gdk_event_is_allocated (event))
|
2014-10-28 05:29:29 +00:00
|
|
|
|
_gdk_display_event_data_copy (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.
|
|
|
|
|
*
|
|
|
|
|
* Frees a #GdkEvent, freeing or decrementing any resources associated with it.
|
|
|
|
|
* Note that this function should only be called with events returned from
|
2010-06-30 19:42:05 +00:00
|
|
|
|
* functions such as gdk_event_peek(), gdk_event_get(), gdk_event_copy()
|
|
|
|
|
* and gdk_event_new().
|
2002-04-25 22:29:14 +00:00
|
|
|
|
**/
|
1998-12-15 13:54:20 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_event_free (GdkEvent *event)
|
|
|
|
|
{
|
2015-08-03 15:22:29 +00:00
|
|
|
|
GdkEventPrivate *private;
|
2011-04-09 01:20:26 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
g_return_if_fail (event != NULL);
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2015-08-03 15:22:29 +00:00
|
|
|
|
if (gdk_event_is_allocated (event))
|
|
|
|
|
{
|
|
|
|
|
private = (GdkEventPrivate *) event;
|
|
|
|
|
g_clear_object (&private->device);
|
|
|
|
|
g_clear_object (&private->source_device);
|
|
|
|
|
}
|
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
switch (event->any.type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
g_free (event->key.string);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
if (event->crossing.subwindow != NULL)
|
2002-09-25 07:23:55 +00:00
|
|
|
|
g_object_unref (event->crossing.subwindow);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GDK_DRAG_ENTER:
|
|
|
|
|
case GDK_DRAG_LEAVE:
|
|
|
|
|
case GDK_DRAG_MOTION:
|
|
|
|
|
case GDK_DRAG_STATUS:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
case GDK_DROP_FINISHED:
|
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:
|
2011-02-17 19:43:31 +00:00
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_PRESS:
|
2000-07-03 19:00:23 +00:00
|
|
|
|
case GDK_BUTTON_RELEASE:
|
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:
|
2009-12-19 18:51:12 +00:00
|
|
|
|
case GDK_DAMAGE:
|
2001-03-09 13:28:26 +00:00
|
|
|
|
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:
|
2007-03-09 21:57:37 +00:00
|
|
|
|
g_free (event->motion.axes);
|
2000-07-03 19:00:23 +00:00
|
|
|
|
break;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
|
2001-04-02 23:33:47 +00:00
|
|
|
|
case GDK_SETTING:
|
|
|
|
|
g_free (event->setting.name);
|
|
|
|
|
break;
|
|
|
|
|
|
2011-01-31 05:43:18 +00:00
|
|
|
|
case GDK_OWNER_CHANGE:
|
2011-02-01 00:35:51 +00:00
|
|
|
|
if (event->owner_change.owner)
|
|
|
|
|
g_object_unref (event->owner_change.owner);
|
2011-01-31 05:43:18 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2011-02-01 16:22:04 +00:00
|
|
|
|
case GDK_SELECTION_CLEAR:
|
|
|
|
|
case GDK_SELECTION_NOTIFY:
|
|
|
|
|
case GDK_SELECTION_REQUEST:
|
|
|
|
|
if (event->selection.requestor)
|
|
|
|
|
g_object_unref (event->selection.requestor);
|
|
|
|
|
break;
|
|
|
|
|
|
1998-12-15 13:54:20 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2002-10-02 21:39:09 +00:00
|
|
|
|
|
2014-10-28 05:29:29 +00:00
|
|
|
|
display = 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
|
|
|
|
|
2014-11-01 18:44:03 +00:00
|
|
|
|
if (event->any.window)
|
|
|
|
|
g_object_unref (event->any.window);
|
|
|
|
|
|
2002-10-02 22:30:37 +00:00
|
|
|
|
g_hash_table_remove (event_hash, event);
|
2005-12-06 10:40:09 +00:00
|
|
|
|
g_slice_free (GdkEventPrivate, (GdkEventPrivate*) event);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-10 10:20:28 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_window:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Extracts the #GdkWindow associated with an event.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (transfer none): The #GdkWindow associated with the event
|
2013-09-10 10:20:28 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 3.10
|
|
|
|
|
*/
|
|
|
|
|
GdkWindow *
|
|
|
|
|
gdk_event_get_window (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
return event->any.window;
|
|
|
|
|
}
|
|
|
|
|
|
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)
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
return event->motion.time;
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_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_PROPERTY_NOTIFY:
|
|
|
|
|
return event->property.time;
|
|
|
|
|
case GDK_SELECTION_CLEAR:
|
|
|
|
|
case GDK_SELECTION_REQUEST:
|
|
|
|
|
case GDK_SELECTION_NOTIFY:
|
|
|
|
|
return event->selection.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_DRAG_STATUS:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
case GDK_DROP_FINISHED:
|
|
|
|
|
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_CLIENT_EVENT:
|
|
|
|
|
case GDK_VISIBILITY_NOTIFY:
|
|
|
|
|
case GDK_CONFIGURE:
|
|
|
|
|
case GDK_FOCUS_CHANGE:
|
|
|
|
|
case GDK_NOTHING:
|
Bug 318807 – Offscreen windows and window redirection.
2008-03-18 10:49:20 Tim Janik <timj@imendio.com>
* Applied pixmap redirection patch by Alexander Larsson with
various updates from:
Bug 318807 – Offscreen windows and window redirection.
Updates:
* updated docs to mention "Since 2.16".
* tests/testgtk.c: fixed snapshooting pixmap leak.
convert pixmap to pixbuf after snapshooting, to compensate for different
bit depths (occurs when snapshooting ARGB visuals and displaying the
pixmap in an RGB visual).
* gdk/gdkwindow.[hc]: made GdkWindowRedirect private.
* gdk/gdkwindow.c: removed damage idle handler, there's no aparent
need for it. enqueue damage notification as GDK_DAMAGE events
for each painting redirection at the start of the event queue.
consider windows with a redirection fully visible when invalidating,
and when updating from backing store. cleaned up stale variables.
* gdk/gdkevents.c: added _gdk_event_queue_prepend().
* gtk/gtkwidget.c: fixed coordinates for !NO_WINDOW widgets in
gtk_widget_get_snapshot; this fixes garbage snap offsets for gammacurve,
tree, drawingarea, text, handlebox, etc.
clip the redirected window hierarchy to window sizes, the visible
rectangles don't need to be taken into account here.
extended snapshooting docs to recommend gdk_pixbuf_get_from_drawable()
in case pixmap visuals could mismatch.
* gdk/x11/gdkwindow-x11.c: removed _gdk_windowing_window_get_visible_rect().
Base patch:
* tests/testgtk.c: add a "Snapshot" test to demonstrate snapshooting
of possibly obscured widgets into an offscreen pixmap.
* gtk/gtkwidget.[hc]: add GtkWidget::damage-event signal, add
gtk_widget_get_snapshot() to render a widget's contents to a GdkPixmap.
* gtk/gtkmain.c: dispatch GDK_DAMAGE events.
* gdk/gdkwindow.c: moved outer gdk_window_new() and gdk_window_reparent()
implementations here, adapted them to propagate redirects to child windows.
gdk_window_end_paint(): copy repainted window contents to redirection pixmap,
clipped to visible region. queue GDK_DAMAGE event delivery.
gdk_window_redirect_to_drawable(): install window painting redirection.
gdk_window_remove_redirection(): remove previously installed redirection.
* gdk/x11/gdkwindow-x11.c: added _gdk_windowing_window_get_visible_rect(),
renamed _gdk_window_new() and _gdk_window_reparent().
* gdk/gdkwindow.h: added GdkWindowRedirect* to GdkWindowObject, export
gdk_window_redirect_to_drawable() and gdk_window_remove_redirection().
* gdk/gdkevents.h: added GDK_DAMAGE event type.
* gdk/gdkevents.c: extract time and state from GDK_DAMAGE events.
* gdk/gdkinternals.h: added internal prototypes.
svn path=/trunk/; revision=20122
2008-05-21 19:04:24 +00:00
|
|
|
|
case GDK_DAMAGE:
|
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_DELETE:
|
|
|
|
|
case GDK_DESTROY:
|
|
|
|
|
case GDK_EXPOSE:
|
|
|
|
|
case GDK_MAP:
|
|
|
|
|
case GDK_UNMAP:
|
2001-02-27 20:40:15 +00:00
|
|
|
|
case GDK_WINDOW_STATE:
|
2001-04-02 23:33:47 +00:00
|
|
|
|
case GDK_SETTING:
|
2004-07-09 22:42:19 +00:00
|
|
|
|
case GDK_OWNER_CHANGE:
|
2005-06-26 07:06:13 +00:00
|
|
|
|
case GDK_GRAB_BROKEN:
|
2009-01-27 14:10:45 +00:00
|
|
|
|
case GDK_EVENT_LAST:
|
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
|
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
|
|
|
|
*
|
2014-02-05 19:50:22 +00:00
|
|
|
|
* If the event contains a “state” field, puts that field in @state. Otherwise
|
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
|
|
|
|
* stores an empty state (0). Returns %TRUE if there was a state field
|
2014-02-07 18:01:26 +00:00
|
|
|
|
* in the event. @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.
|
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
|
|
|
|
*
|
2014-02-19 23:49:43 +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
|
2008-01-15 15:32:37 +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)
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
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_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_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_PROPERTY_NOTIFY:
|
|
|
|
|
case GDK_VISIBILITY_NOTIFY:
|
|
|
|
|
case GDK_CLIENT_EVENT:
|
|
|
|
|
case GDK_CONFIGURE:
|
|
|
|
|
case GDK_FOCUS_CHANGE:
|
|
|
|
|
case GDK_SELECTION_CLEAR:
|
|
|
|
|
case GDK_SELECTION_REQUEST:
|
|
|
|
|
case GDK_SELECTION_NOTIFY:
|
|
|
|
|
case GDK_PROXIMITY_IN:
|
|
|
|
|
case GDK_PROXIMITY_OUT:
|
Bug 318807 – Offscreen windows and window redirection.
2008-03-18 10:49:20 Tim Janik <timj@imendio.com>
* Applied pixmap redirection patch by Alexander Larsson with
various updates from:
Bug 318807 – Offscreen windows and window redirection.
Updates:
* updated docs to mention "Since 2.16".
* tests/testgtk.c: fixed snapshooting pixmap leak.
convert pixmap to pixbuf after snapshooting, to compensate for different
bit depths (occurs when snapshooting ARGB visuals and displaying the
pixmap in an RGB visual).
* gdk/gdkwindow.[hc]: made GdkWindowRedirect private.
* gdk/gdkwindow.c: removed damage idle handler, there's no aparent
need for it. enqueue damage notification as GDK_DAMAGE events
for each painting redirection at the start of the event queue.
consider windows with a redirection fully visible when invalidating,
and when updating from backing store. cleaned up stale variables.
* gdk/gdkevents.c: added _gdk_event_queue_prepend().
* gtk/gtkwidget.c: fixed coordinates for !NO_WINDOW widgets in
gtk_widget_get_snapshot; this fixes garbage snap offsets for gammacurve,
tree, drawingarea, text, handlebox, etc.
clip the redirected window hierarchy to window sizes, the visible
rectangles don't need to be taken into account here.
extended snapshooting docs to recommend gdk_pixbuf_get_from_drawable()
in case pixmap visuals could mismatch.
* gdk/x11/gdkwindow-x11.c: removed _gdk_windowing_window_get_visible_rect().
Base patch:
* tests/testgtk.c: add a "Snapshot" test to demonstrate snapshooting
of possibly obscured widgets into an offscreen pixmap.
* gtk/gtkwidget.[hc]: add GtkWidget::damage-event signal, add
gtk_widget_get_snapshot() to render a widget's contents to a GdkPixmap.
* gtk/gtkmain.c: dispatch GDK_DAMAGE events.
* gdk/gdkwindow.c: moved outer gdk_window_new() and gdk_window_reparent()
implementations here, adapted them to propagate redirects to child windows.
gdk_window_end_paint(): copy repainted window contents to redirection pixmap,
clipped to visible region. queue GDK_DAMAGE event delivery.
gdk_window_redirect_to_drawable(): install window painting redirection.
gdk_window_remove_redirection(): remove previously installed redirection.
* gdk/x11/gdkwindow-x11.c: added _gdk_windowing_window_get_visible_rect(),
renamed _gdk_window_new() and _gdk_window_reparent().
* gdk/gdkwindow.h: added GdkWindowRedirect* to GdkWindowObject, export
gdk_window_redirect_to_drawable() and gdk_window_remove_redirection().
* gdk/gdkevents.h: added GDK_DAMAGE event type.
* gdk/gdkevents.c: extract time and state from GDK_DAMAGE events.
* gdk/gdkinternals.h: added internal prototypes.
svn path=/trunk/; revision=20122
2008-05-21 19:04:24 +00:00
|
|
|
|
case GDK_DAMAGE:
|
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_DRAG_ENTER:
|
|
|
|
|
case GDK_DRAG_LEAVE:
|
|
|
|
|
case GDK_DRAG_MOTION:
|
|
|
|
|
case GDK_DRAG_STATUS:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
case GDK_DROP_FINISHED:
|
|
|
|
|
case GDK_NOTHING:
|
|
|
|
|
case GDK_DELETE:
|
|
|
|
|
case GDK_DESTROY:
|
|
|
|
|
case GDK_EXPOSE:
|
|
|
|
|
case GDK_MAP:
|
|
|
|
|
case GDK_UNMAP:
|
2001-02-27 20:40:15 +00:00
|
|
|
|
case GDK_WINDOW_STATE:
|
2001-04-02 23:33:47 +00:00
|
|
|
|
case GDK_SETTING:
|
2004-07-09 22:42:19 +00:00
|
|
|
|
case GDK_OWNER_CHANGE:
|
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:
|
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
|
2015-07-24 12:36:30 +00:00
|
|
|
|
* @x_win: (out) (optional): location to put event window x coordinate
|
|
|
|
|
* @y_win: (out) (optional): location to put event window y coordinate
|
2001-06-28 22:49:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Extract the event window relative x/y coordinates from an event.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered event window 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;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
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_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_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
|
2001-06-28 22:49:20 +00:00
|
|
|
|
*
|
|
|
|
|
* Extract the root window relative x/y coordinates from an event.
|
|
|
|
|
*
|
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);
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
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_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_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_DRAG_STATUS:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
case GDK_DROP_FINISHED:
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
*
|
|
|
|
|
* Since: 3.2
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_button (const GdkEvent *event,
|
|
|
|
|
guint *button)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
guint number = 0;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_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
|
|
|
|
*
|
|
|
|
|
* Since: 3.2
|
|
|
|
|
*/
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
number = 1;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
|
number = 2;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
|
number = 3;
|
|
|
|
|
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
|
|
|
|
*
|
|
|
|
|
* Since: 3.2
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_keyval (const GdkEvent *event,
|
|
|
|
|
guint *keyval)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
guint number = 0;
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
number = event->key.keyval;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (keyval)
|
|
|
|
|
*keyval = number;
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
|
* Since: 3.2
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_keycode (const GdkEvent *event,
|
|
|
|
|
guint16 *keycode)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
guint16 number = 0;
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
number = event->key.hardware_keycode;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
fetched = FALSE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (keycode)
|
|
|
|
|
*keycode = number;
|
|
|
|
|
|
|
|
|
|
return fetched;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_scroll_direction:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @direction: (out): location to store the scroll direction
|
|
|
|
|
*
|
|
|
|
|
* Extracts the scroll direction from an event.
|
|
|
|
|
*
|
2019-11-13 15:24:35 +00:00
|
|
|
|
* If @event is not of type %GDK_SCROLL, the contents of @direction
|
|
|
|
|
* are undefined.
|
|
|
|
|
*
|
|
|
|
|
* If you wish to handle both discrete and smooth scrolling, you
|
|
|
|
|
* should check the return value of this function, or of
|
|
|
|
|
* gdk_event_get_scroll_deltas(); for instance:
|
|
|
|
|
*
|
|
|
|
|
* |[<!-- language="C" -->
|
|
|
|
|
* GdkScrollDirection direction;
|
|
|
|
|
* double vscroll_factor = 0.0;
|
|
|
|
|
* double x_scroll, y_scroll;
|
|
|
|
|
*
|
|
|
|
|
* if (gdk_event_get_scroll_direction (event, &direction))
|
|
|
|
|
* {
|
|
|
|
|
* // Handle discrete scrolling with a known constant delta;
|
|
|
|
|
* const double delta = 12.0;
|
|
|
|
|
*
|
|
|
|
|
* switch (direction)
|
|
|
|
|
* {
|
|
|
|
|
* case GDK_SCROLL_UP:
|
|
|
|
|
* vscroll_factor = -delta;
|
|
|
|
|
* break;
|
|
|
|
|
* case GDK_SCROLL_DOWN:
|
|
|
|
|
* vscroll_factor = delta;
|
|
|
|
|
* break;
|
|
|
|
|
* default:
|
|
|
|
|
* // no scrolling
|
|
|
|
|
* break;
|
|
|
|
|
* }
|
|
|
|
|
* }
|
|
|
|
|
* else if (gdk_event_get_scroll_deltas (event, &x_scroll, &y_scroll))
|
|
|
|
|
* {
|
|
|
|
|
* // Handle smooth scrolling directly
|
|
|
|
|
* vscroll_factor = y_scroll;
|
|
|
|
|
* }
|
|
|
|
|
* ]|
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: %TRUE if the event delivered a scroll direction
|
2019-11-13 15:24:35 +00:00
|
|
|
|
* and %FALSE otherwise
|
2011-08-28 19:26:47 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 3.2
|
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_get_scroll_direction (const GdkEvent *event,
|
|
|
|
|
GdkScrollDirection *direction)
|
|
|
|
|
{
|
|
|
|
|
gboolean fetched = TRUE;
|
|
|
|
|
GdkScrollDirection dir = 0;
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
*
|
2019-11-13 15:24:35 +00:00
|
|
|
|
* See also: gdk_event_get_scroll_direction()
|
|
|
|
|
*
|
2012-01-23 22:37:44 +00:00
|
|
|
|
* Returns: %TRUE if the event contains smooth scroll information
|
2019-11-13 15:24:35 +00:00
|
|
|
|
* and %FALSE otherwise
|
2012-01-23 22:37:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
**/
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
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
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.20
|
|
|
|
|
*/
|
|
|
|
|
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
|
2000-07-03 19:00:23 +00:00
|
|
|
|
*
|
|
|
|
|
* Extract the axis value for a particular axis use from
|
|
|
|
|
* an event structure.
|
|
|
|
|
*
|
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;
|
|
|
|
|
GdkDevice *device;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
if (axis_use == GDK_AXIS_X || axis_use == GDK_AXIS_Y)
|
|
|
|
|
{
|
|
|
|
|
gdouble x, y;
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
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;
|
|
|
|
|
}
|
|
|
|
|
else if (event->type == GDK_BUTTON_PRESS ||
|
|
|
|
|
event->type == GDK_BUTTON_RELEASE)
|
|
|
|
|
{
|
|
|
|
|
device = event->button.device;
|
|
|
|
|
axes = event->button.axes;
|
|
|
|
|
}
|
2011-02-28 19:53:42 +00:00
|
|
|
|
else if (event->type == GDK_TOUCH_BEGIN ||
|
|
|
|
|
event->type == GDK_TOUCH_UPDATE ||
|
|
|
|
|
event->type == GDK_TOUCH_END ||
|
|
|
|
|
event->type == GDK_TOUCH_CANCEL)
|
|
|
|
|
{
|
|
|
|
|
device = event->touch.device;
|
|
|
|
|
axes = event->touch.axes;
|
|
|
|
|
}
|
2000-07-03 19:00:23 +00:00
|
|
|
|
else if (event->type == GDK_MOTION_NOTIFY)
|
|
|
|
|
{
|
|
|
|
|
device = event->motion.device;
|
|
|
|
|
axes = event->motion.axes;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return gdk_device_get_axis (device, axes, axis_use, value);
|
|
|
|
|
}
|
|
|
|
|
|
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().
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_device (GdkEvent *event,
|
|
|
|
|
GdkDevice *device)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (gdk_event_is_allocated (event));
|
|
|
|
|
|
|
|
|
|
private = (GdkEventPrivate *) event;
|
|
|
|
|
|
2015-08-03 15:22:29 +00:00
|
|
|
|
g_set_object (&private->device, device);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
event->motion.device = device;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
event->button.device = device;
|
|
|
|
|
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:
|
|
|
|
|
event->touch.device = device;
|
|
|
|
|
break;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
event->scroll.device = device;
|
|
|
|
|
break;
|
|
|
|
|
case GDK_PROXIMITY_IN:
|
|
|
|
|
case GDK_PROXIMITY_OUT:
|
|
|
|
|
event->proximity.device = device;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
**/
|
|
|
|
|
GdkDevice *
|
|
|
|
|
gdk_event_get_device (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
if (gdk_event_is_allocated (event))
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private = (GdkEventPrivate *) event;
|
|
|
|
|
|
|
|
|
|
if (private->device)
|
|
|
|
|
return private->device;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
return event->motion.device;
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
return event->button.device;
|
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.device;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
return event->scroll.device;
|
|
|
|
|
case GDK_PROXIMITY_IN:
|
|
|
|
|
case GDK_PROXIMITY_OUT:
|
|
|
|
|
return event->proximity.device;
|
2010-06-04 15:06:57 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fallback if event has no device set */
|
|
|
|
|
switch (event->type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_MOTION_NOTIFY:
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_2BUTTON_PRESS:
|
|
|
|
|
case GDK_3BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
2011-02-28 19:53:42 +00:00
|
|
|
|
case GDK_TOUCH_BEGIN:
|
|
|
|
|
case GDK_TOUCH_UPDATE:
|
|
|
|
|
case GDK_TOUCH_END:
|
|
|
|
|
case GDK_TOUCH_CANCEL:
|
2010-06-04 15:06:57 +00:00
|
|
|
|
case GDK_ENTER_NOTIFY:
|
|
|
|
|
case GDK_LEAVE_NOTIFY:
|
|
|
|
|
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_DRAG_STATUS:
|
|
|
|
|
case GDK_DROP_START:
|
|
|
|
|
case GDK_DROP_FINISHED:
|
|
|
|
|
case GDK_SCROLL:
|
|
|
|
|
case GDK_GRAB_BROKEN:
|
|
|
|
|
case GDK_KEY_PRESS:
|
|
|
|
|
case GDK_KEY_RELEASE:
|
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
2015-12-15 22:24:59 +00:00
|
|
|
|
GdkSeat *seat;
|
2010-06-04 15:06:57 +00:00
|
|
|
|
|
|
|
|
|
g_warning ("Event with type %d not holding a GdkDevice. "
|
2016-02-28 17:20:39 +00:00
|
|
|
|
"It is most likely synthesized outside Gdk/GTK+",
|
2010-06-04 15:06:57 +00:00
|
|
|
|
event->type);
|
|
|
|
|
|
2010-08-29 00:08:47 +00:00
|
|
|
|
display = gdk_window_get_display (event->any.window);
|
2015-12-15 22:24:59 +00:00
|
|
|
|
seat = gdk_display_get_default_seat (display);
|
2010-06-04 15:06:57 +00:00
|
|
|
|
|
|
|
|
|
if (event->type == GDK_KEY_PRESS ||
|
|
|
|
|
event->type == GDK_KEY_RELEASE)
|
2015-12-15 22:24:59 +00:00
|
|
|
|
return gdk_seat_get_keyboard (seat);
|
2010-06-04 15:06:57 +00:00
|
|
|
|
else
|
2015-12-15 22:24:59 +00:00
|
|
|
|
return gdk_seat_get_pointer (seat);
|
2010-06-04 15:06:57 +00:00
|
|
|
|
}
|
|
|
|
|
break;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
default:
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_source_device (GdkEvent *event,
|
|
|
|
|
GdkDevice *device)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (gdk_event_is_allocated (event));
|
|
|
|
|
g_return_if_fail (GDK_IS_DEVICE (device));
|
|
|
|
|
|
|
|
|
|
private = (GdkEventPrivate *) event;
|
|
|
|
|
|
2015-08-03 15:22:29 +00:00
|
|
|
|
g_set_object (&private->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
|
|
|
|
|
* in synthesized crossing events after a #GdkWindow updates its
|
|
|
|
|
* 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
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
**/
|
|
|
|
|
GdkDevice *
|
|
|
|
|
gdk_event_get_source_device (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (event != NULL, NULL);
|
|
|
|
|
|
|
|
|
|
if (!gdk_event_is_allocated (event))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
private = (GdkEventPrivate *) event;
|
|
|
|
|
|
|
|
|
|
if (private->source_device)
|
|
|
|
|
return private->source_device;
|
|
|
|
|
|
|
|
|
|
/* Fallback to event device */
|
|
|
|
|
return gdk_event_get_device (event);
|
|
|
|
|
}
|
|
|
|
|
|
2007-02-06 14:53:35 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_request_motions:
|
|
|
|
|
* @event: a valid #GdkEvent
|
|
|
|
|
*
|
2007-06-07 04:28:56 +00:00
|
|
|
|
* Request more motion notifies if @event is a motion notify hint event.
|
2011-01-20 03:52:55 +00:00
|
|
|
|
*
|
2007-02-06 15:02:59 +00:00
|
|
|
|
* This function should be used instead of gdk_window_get_pointer() to
|
2007-02-06 14:53:35 +00:00
|
|
|
|
* request further motion notifies, because it also works for extension
|
|
|
|
|
* events where motion notifies are provided for devices other than the
|
2007-07-04 10:21:05 +00:00
|
|
|
|
* core pointer. Coordinate extraction, processing and requesting more
|
|
|
|
|
* motion events from a %GDK_MOTION_NOTIFY event usually works like this:
|
|
|
|
|
*
|
2014-01-27 19:55:18 +00:00
|
|
|
|
* |[<!-- language="C" -->
|
2011-01-20 03:52:55 +00:00
|
|
|
|
* {
|
2014-02-15 04:34:22 +00:00
|
|
|
|
* // motion_event handler
|
2007-07-04 10:21:05 +00:00
|
|
|
|
* x = motion_event->x;
|
|
|
|
|
* y = motion_event->y;
|
2014-02-15 04:34:22 +00:00
|
|
|
|
* // handle (x,y) motion
|
|
|
|
|
* gdk_event_request_motions (motion_event); // handles is_hint events
|
2007-07-04 10:21:05 +00:00
|
|
|
|
* }
|
2007-11-25 06:51:19 +00:00
|
|
|
|
* ]|
|
2007-02-06 14:53:35 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.12
|
|
|
|
|
**/
|
|
|
|
|
void
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_request_motions (const GdkEventMotion *event)
|
2007-02-06 14:53:35 +00:00
|
|
|
|
{
|
2009-01-23 12:04:44 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2007-02-06 14:53:35 +00:00
|
|
|
|
g_return_if_fail (event != NULL);
|
2009-01-23 12:04:44 +00:00
|
|
|
|
|
2007-02-06 14:53:35 +00:00
|
|
|
|
if (event->type == GDK_MOTION_NOTIFY && event->is_hint)
|
2009-01-23 12:04:44 +00:00
|
|
|
|
{
|
|
|
|
|
gdk_device_get_state (event->device, event->window, NULL, NULL);
|
|
|
|
|
|
2010-08-29 00:08:47 +00:00
|
|
|
|
display = gdk_window_get_display (event->window);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
_gdk_display_enable_motion_hints (display, event->device);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_event_triggers_context_menu (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, FALSE);
|
|
|
|
|
|
|
|
|
|
if (event->type == GDK_BUTTON_PRESS)
|
|
|
|
|
{
|
|
|
|
|
const GdkEventButton *bevent = (const GdkEventButton *) event;
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
GdkModifierType modifier;
|
|
|
|
|
|
|
|
|
|
g_return_val_if_fail (GDK_IS_WINDOW (bevent->window), FALSE);
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
display = gdk_window_get_display (bevent->window);
|
|
|
|
|
|
|
|
|
|
modifier = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
|
|
|
|
|
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.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
**/
|
|
|
|
|
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.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
**/
|
|
|
|
|
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.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.0
|
|
|
|
|
**/
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2002-10-02 21:39:09 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_event_set_screen:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
* @screen: a #GdkScreen
|
|
|
|
|
*
|
|
|
|
|
* Sets the screen for @event to @screen. The event must
|
|
|
|
|
* have been allocated by GTK+, for instance, by
|
|
|
|
|
* gdk_event_copy().
|
2002-11-28 00:33:17 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.2
|
2002-10-02 21:39:09 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_screen (GdkEvent *event,
|
|
|
|
|
GdkScreen *screen)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (gdk_event_is_allocated (event));
|
|
|
|
|
|
|
|
|
|
private = (GdkEventPrivate *)event;
|
|
|
|
|
|
|
|
|
|
private->screen = screen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_event_get_screen:
|
|
|
|
|
* @event: a #GdkEvent
|
|
|
|
|
*
|
|
|
|
|
* Returns the screen for the event. The screen is
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* typically the screen for `event->any.window`, but
|
2002-10-02 21:39:09 +00:00
|
|
|
|
* for events such as mouse events, it is the screen
|
2005-02-01 18:15:09 +00:00
|
|
|
|
* where the pointer was when the event occurs -
|
2002-10-02 21:39:09 +00:00
|
|
|
|
* that is, the screen which has the root window
|
2014-02-04 23:21:13 +00:00
|
|
|
|
* to which `event->motion.x_root` and
|
|
|
|
|
* `event->motion.y_root` are relative.
|
2002-10-02 21:39:09 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (transfer none): the screen for the event
|
2002-11-28 00:33:17 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.2
|
2002-10-02 21:39:09 +00:00
|
|
|
|
**/
|
|
|
|
|
GdkScreen *
|
2008-01-15 15:32:37 +00:00
|
|
|
|
gdk_event_get_screen (const GdkEvent *event)
|
2002-10-02 21:39:09 +00:00
|
|
|
|
{
|
|
|
|
|
if (gdk_event_is_allocated (event))
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private = (GdkEventPrivate *)event;
|
|
|
|
|
|
|
|
|
|
if (private->screen)
|
|
|
|
|
return private->screen;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (event->any.window)
|
2010-08-28 23:32:52 +00:00
|
|
|
|
return gdk_window_get_screen (event->any.window);
|
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
|
|
|
|
*
|
|
|
|
|
* Since: 3.4
|
|
|
|
|
*/
|
|
|
|
|
GdkEventSequence *
|
|
|
|
|
gdk_event_get_event_sequence (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (!event)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2011-02-28 19:53:42 +00:00
|
|
|
|
if (event->type == GDK_TOUCH_BEGIN ||
|
|
|
|
|
event->type == GDK_TOUCH_UPDATE ||
|
|
|
|
|
event->type == GDK_TOUCH_END ||
|
|
|
|
|
event->type == GDK_TOUCH_CANCEL)
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2001-10-28 21:28:51 +00:00
|
|
|
|
static void
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_synthesize_click (GdkDisplay *display,
|
2011-01-20 03:52:55 +00:00
|
|
|
|
GdkEvent *event,
|
|
|
|
|
gint nclicks)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
2008-07-18 13:03:42 +00:00
|
|
|
|
GdkEvent *event_copy;
|
|
|
|
|
|
2011-01-20 03:52:55 +00:00
|
|
|
|
event_copy = gdk_event_copy (event);
|
|
|
|
|
event_copy->type = (nclicks == 2) ? GDK_2BUTTON_PRESS : GDK_3BUTTON_PRESS;
|
|
|
|
|
|
2011-01-23 23:50:09 +00:00
|
|
|
|
_gdk_event_queue_append (display, event_copy);
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
1999-11-08 20:14:59 +00:00
|
|
|
|
void
|
2002-04-25 22:29:14 +00:00
|
|
|
|
_gdk_event_button_generate (GdkDisplay *display,
|
|
|
|
|
GdkEvent *event)
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkMultipleClickInfo *info;
|
2016-02-22 21:40:50 +00:00
|
|
|
|
GdkDevice *source_device;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2011-01-20 03:52:55 +00:00
|
|
|
|
g_return_if_fail (event->type == GDK_BUTTON_PRESS);
|
|
|
|
|
|
2016-02-22 21:40:50 +00:00
|
|
|
|
source_device = gdk_event_get_source_device (event);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
info = g_hash_table_lookup (display->multiple_click_info, event->button.device);
|
|
|
|
|
|
|
|
|
|
if (G_UNLIKELY (!info))
|
|
|
|
|
{
|
|
|
|
|
info = g_new0 (GdkMultipleClickInfo, 1);
|
|
|
|
|
info->button_number[0] = info->button_number[1] = -1;
|
|
|
|
|
|
|
|
|
|
g_hash_table_insert (display->multiple_click_info,
|
|
|
|
|
event->button.device, info);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((event->button.time < (info->button_click_time[1] + 2 * display->double_click_time)) &&
|
|
|
|
|
(event->button.window == info->button_window[1]) &&
|
|
|
|
|
(event->button.button == info->button_number[1]) &&
|
2016-02-22 21:40:50 +00:00
|
|
|
|
(source_device == info->last_slave) &&
|
2010-05-25 22:38:44 +00:00
|
|
|
|
(ABS (event->button.x - info->button_x[1]) <= display->double_click_distance) &&
|
|
|
|
|
(ABS (event->button.y - info->button_y[1]) <= display->double_click_distance))
|
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_synthesize_click (display, event, 3);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
info->button_click_time[1] = 0;
|
|
|
|
|
info->button_click_time[0] = 0;
|
|
|
|
|
info->button_window[1] = NULL;
|
|
|
|
|
info->button_window[0] = NULL;
|
|
|
|
|
info->button_number[1] = -1;
|
|
|
|
|
info->button_number[0] = -1;
|
|
|
|
|
info->button_x[0] = info->button_x[1] = 0;
|
|
|
|
|
info->button_y[0] = info->button_y[1] = 0;
|
2016-02-22 21:40:50 +00:00
|
|
|
|
info->last_slave = NULL;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
2010-05-25 22:38:44 +00:00
|
|
|
|
else if ((event->button.time < (info->button_click_time[0] + display->double_click_time)) &&
|
|
|
|
|
(event->button.window == info->button_window[0]) &&
|
|
|
|
|
(event->button.button == info->button_number[0]) &&
|
2016-02-22 21:40:50 +00:00
|
|
|
|
(source_device == info->last_slave) &&
|
2010-05-25 22:38:44 +00:00
|
|
|
|
(ABS (event->button.x - info->button_x[0]) <= display->double_click_distance) &&
|
|
|
|
|
(ABS (event->button.y - info->button_y[0]) <= display->double_click_distance))
|
1998-12-15 13:54:20 +00:00
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_synthesize_click (display, event, 2);
|
1999-11-08 20:14:59 +00:00
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
info->button_click_time[1] = info->button_click_time[0];
|
|
|
|
|
info->button_click_time[0] = event->button.time;
|
|
|
|
|
info->button_window[1] = info->button_window[0];
|
|
|
|
|
info->button_window[0] = event->button.window;
|
|
|
|
|
info->button_number[1] = info->button_number[0];
|
|
|
|
|
info->button_number[0] = event->button.button;
|
|
|
|
|
info->button_x[1] = info->button_x[0];
|
|
|
|
|
info->button_x[0] = event->button.x;
|
|
|
|
|
info->button_y[1] = info->button_y[0];
|
|
|
|
|
info->button_y[0] = event->button.y;
|
2016-02-22 21:40:50 +00:00
|
|
|
|
info->last_slave = source_device;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2010-05-25 22:38:44 +00:00
|
|
|
|
info->button_click_time[1] = 0;
|
|
|
|
|
info->button_click_time[0] = event->button.time;
|
|
|
|
|
info->button_window[1] = NULL;
|
|
|
|
|
info->button_window[0] = event->button.window;
|
|
|
|
|
info->button_number[1] = -1;
|
|
|
|
|
info->button_number[0] = event->button.button;
|
|
|
|
|
info->button_x[1] = 0;
|
|
|
|
|
info->button_x[0] = event->button.x;
|
|
|
|
|
info->button_y[1] = 0;
|
|
|
|
|
info->button_y[0] = event->button.y;
|
2016-02-22 21:40:50 +00:00
|
|
|
|
info->last_slave = source_device;
|
1998-12-15 13:54:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2001-02-27 20:40:15 +00:00
|
|
|
|
|
2016-02-26 06:10:06 +00:00
|
|
|
|
static GList *
|
|
|
|
|
gdk_get_pending_window_state_event_link (GdkWindow *window)
|
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display = gdk_window_get_display (window);
|
|
|
|
|
GList *tmp_list;
|
|
|
|
|
|
|
|
|
|
for (tmp_list = display->queued_events; tmp_list; tmp_list = tmp_list->next)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *event = tmp_list->data;
|
|
|
|
|
|
|
|
|
|
if (event->event.type == GDK_WINDOW_STATE &&
|
|
|
|
|
event->event.window_state.window == window)
|
|
|
|
|
return tmp_list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-27 20:40:15 +00:00
|
|
|
|
void
|
2014-04-12 00:04:25 +00:00
|
|
|
|
_gdk_set_window_state (GdkWindow *window,
|
|
|
|
|
GdkWindowState new_state)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2016-02-26 06:10:06 +00:00
|
|
|
|
GdkDisplay *display = gdk_window_get_display (window);
|
2001-12-04 17:12:35 +00:00
|
|
|
|
GdkEvent temp_event;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
GdkWindowState old;
|
2016-02-26 06:10:06 +00:00
|
|
|
|
GList *pending_event_link;
|
2014-04-12 00:04:25 +00:00
|
|
|
|
|
2001-02-27 20:40:15 +00:00
|
|
|
|
g_return_if_fail (window != NULL);
|
2014-04-12 00:04:25 +00:00
|
|
|
|
|
2001-12-04 17:12:35 +00:00
|
|
|
|
temp_event.window_state.window = window;
|
|
|
|
|
temp_event.window_state.type = GDK_WINDOW_STATE;
|
|
|
|
|
temp_event.window_state.send_event = FALSE;
|
2014-04-12 00:04:25 +00:00
|
|
|
|
temp_event.window_state.new_window_state = new_state;
|
|
|
|
|
|
2016-02-26 06:10:06 +00:00
|
|
|
|
if (temp_event.window_state.new_window_state == window->state)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
return; /* No actual work to do, nothing changed. */
|
|
|
|
|
|
2016-02-26 06:10:06 +00:00
|
|
|
|
pending_event_link = gdk_get_pending_window_state_event_link (window);
|
|
|
|
|
if (pending_event_link)
|
|
|
|
|
{
|
|
|
|
|
old = window->old_state;
|
|
|
|
|
_gdk_event_queue_remove_link (display, pending_event_link);
|
2016-03-11 05:13:31 +00:00
|
|
|
|
gdk_event_free (pending_event_link->data);
|
2016-02-26 06:10:06 +00:00
|
|
|
|
g_list_free_1 (pending_event_link);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
old = window->state;
|
|
|
|
|
window->old_state = old;
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-12 00:04:25 +00:00
|
|
|
|
temp_event.window_state.changed_mask = new_state ^ old;
|
|
|
|
|
|
2001-02-27 20:40:15 +00:00
|
|
|
|
/* Actually update the field in GdkWindow, this is sort of an odd
|
|
|
|
|
* place to do it, but seems like the safest since it ensures we expose no
|
|
|
|
|
* inconsistent state to the user.
|
|
|
|
|
*/
|
2014-04-12 00:04:25 +00:00
|
|
|
|
|
|
|
|
|
window->state = new_state;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
|
2009-07-18 18:29:50 +00:00
|
|
|
|
if (temp_event.window_state.changed_mask & GDK_WINDOW_STATE_WITHDRAWN)
|
|
|
|
|
_gdk_window_update_viewable (window);
|
|
|
|
|
|
2001-02-27 20:40:15 +00:00
|
|
|
|
/* We only really send the event to toplevels, since
|
|
|
|
|
* all the window states don't apply to non-toplevels.
|
|
|
|
|
* Non-toplevels do use the GDK_WINDOW_STATE_WITHDRAWN flag
|
|
|
|
|
* internally so we needed to update window->state.
|
|
|
|
|
*/
|
2010-11-22 23:55:39 +00:00
|
|
|
|
switch (window->window_type)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_WINDOW_TOPLEVEL:
|
|
|
|
|
case GDK_WINDOW_TEMP: /* ? */
|
2016-02-26 06:10:06 +00:00
|
|
|
|
gdk_display_put_event (display, &temp_event);
|
2001-02-27 20:40:15 +00:00
|
|
|
|
break;
|
|
|
|
|
case GDK_WINDOW_FOREIGN:
|
|
|
|
|
case GDK_WINDOW_ROOT:
|
|
|
|
|
case GDK_WINDOW_CHILD:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-12 00:04:25 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_synthesize_window_state (GdkWindow *window,
|
|
|
|
|
GdkWindowState unset_flags,
|
|
|
|
|
GdkWindowState set_flags)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (window != NULL);
|
|
|
|
|
|
|
|
|
|
_gdk_set_window_state (window, (window->state | set_flags) & ~unset_flags);
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
/**
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* gdk_display_set_double_click_time:
|
|
|
|
|
* @display: a #GdkDisplay
|
|
|
|
|
* @msec: double click time in milliseconds (thousandths of a second)
|
|
|
|
|
*
|
2001-10-03 18:19:48 +00:00
|
|
|
|
* Sets the double click time (two clicks within this time interval
|
|
|
|
|
* count as a double click and result in a #GDK_2BUTTON_PRESS event).
|
2014-01-28 06:54:48 +00:00
|
|
|
|
* Applications should not set this, it is a global
|
2003-12-16 00:56:48 +00:00
|
|
|
|
* user-configured setting.
|
2002-11-28 00:33:17 +00:00
|
|
|
|
*
|
|
|
|
|
* Since: 2.2
|
2002-04-25 22:29:14 +00:00
|
|
|
|
**/
|
|
|
|
|
void
|
2002-06-20 18:55:56 +00:00
|
|
|
|
gdk_display_set_double_click_time (GdkDisplay *display,
|
|
|
|
|
guint msec)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
{
|
|
|
|
|
display->double_click_time = msec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_set_double_click_time:
|
|
|
|
|
* @msec: double click time in milliseconds (thousandths of a second)
|
2001-10-03 18:19:48 +00:00
|
|
|
|
*
|
2002-04-25 22:29:14 +00:00
|
|
|
|
* Set the double click time for the default display. See
|
2003-12-16 00:56:48 +00:00
|
|
|
|
* gdk_display_set_double_click_time().
|
|
|
|
|
* See also gdk_display_set_double_click_distance().
|
2014-01-28 06:54:48 +00:00
|
|
|
|
* Applications should not set this, it is a
|
2003-12-16 00:56:48 +00:00
|
|
|
|
* global user-configured setting.
|
2001-10-03 18:19:48 +00:00
|
|
|
|
**/
|
2001-04-02 23:33:47 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_set_double_click_time (guint msec)
|
|
|
|
|
{
|
2002-06-20 23:59:27 +00:00
|
|
|
|
gdk_display_set_double_click_time (gdk_display_get_default (), msec);
|
2001-04-02 23:33:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-12-16 00:56:48 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_display_set_double_click_distance:
|
|
|
|
|
* @display: a #GdkDisplay
|
|
|
|
|
* @distance: distance in pixels
|
|
|
|
|
*
|
|
|
|
|
* Sets the double click distance (two clicks within this distance
|
|
|
|
|
* count as a double click and result in a #GDK_2BUTTON_PRESS event).
|
|
|
|
|
* See also gdk_display_set_double_click_time().
|
2014-01-28 06:54:48 +00:00
|
|
|
|
* Applications should not set this, it is a global
|
2003-12-16 00:56:48 +00:00
|
|
|
|
* user-configured setting.
|
|
|
|
|
*
|
|
|
|
|
* Since: 2.4
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_display_set_double_click_distance (GdkDisplay *display,
|
|
|
|
|
guint distance)
|
|
|
|
|
{
|
|
|
|
|
display->double_click_distance = distance;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-27 11:31:23 +00:00
|
|
|
|
G_DEFINE_BOXED_TYPE (GdkEvent, gdk_event,
|
|
|
|
|
gdk_event_copy,
|
|
|
|
|
gdk_event_free)
|
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
|
|
|
|
|
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)
|
|
|
|
|
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
Changes multihead reorganizing code for win32 support,
mostly from a patch by Hans Breuer.
* gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c
gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c
gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c
gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c
gdk/gdkscreen.c gdk/x11/gdkmain-x11.c
gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c
gdk/x11/gdkpango-x11.c gdk/gdkselection.c
gdk/x11/gdkselection-x11.c gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c:
Move port-independent singlehead wrapper functions into
port-independent part of GDK. (#80009)
* gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c
gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c
gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c
gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c:
Turn singlehead functions into "multihead" functions that ignore
their GdkDisplay or GdkScreen arguments.
* gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h:
Misc multihead-compatibility changes.
* gtk/gtk.def gdk/gdk.def: Update for multihead functions.
* gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c
gdk/x11/gdkvisual-x11.c: Remove the screen fields
from the public parts of the colormap/visual structures, add accessors
instead.
* gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c
gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c
gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen
for colormaps, visuals; move the fields into the private
structures for the x11 backend.
* gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c:
Remove virtualization of screen and display functions.
(#79990, patch from Erwann Chenede)
* gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c
gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}:
New files containing stub implementations of Display,
Screen functions.
* gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/x11/gdkx.h: Clean up function exports and what
headers they are in. (#79954)
* gdk/x11/gdkx.h: Fix macro that was referring to a non-existant
screen->screen_num. (In the patch for #79972, Erwann Chenede)
* gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h
gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer()
to use window hooks. (#79972, patch partly from Erwann Chenede)
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix
some warnings.
2002-06-06 00:26:42 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_setting_get:
|
|
|
|
|
* @name: the name of the setting.
|
|
|
|
|
* @value: location to store the value of the setting.
|
|
|
|
|
*
|
|
|
|
|
* Obtains a desktop-wide setting, such as the double-click time,
|
|
|
|
|
* for the default screen. See gdk_screen_get_setting().
|
|
|
|
|
*
|
2008-07-04 21:55:21 +00:00
|
|
|
|
* Returns: %TRUE if the setting existed and a value was stored
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
Changes multihead reorganizing code for win32 support,
mostly from a patch by Hans Breuer.
* gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c
gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c
gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c
gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c
gdk/gdkscreen.c gdk/x11/gdkmain-x11.c
gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c
gdk/x11/gdkpango-x11.c gdk/gdkselection.c
gdk/x11/gdkselection-x11.c gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c:
Move port-independent singlehead wrapper functions into
port-independent part of GDK. (#80009)
* gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c
gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c
gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c
gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c:
Turn singlehead functions into "multihead" functions that ignore
their GdkDisplay or GdkScreen arguments.
* gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h:
Misc multihead-compatibility changes.
* gtk/gtk.def gdk/gdk.def: Update for multihead functions.
* gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c
gdk/x11/gdkvisual-x11.c: Remove the screen fields
from the public parts of the colormap/visual structures, add accessors
instead.
* gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c
gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c
gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen
for colormaps, visuals; move the fields into the private
structures for the x11 backend.
* gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c:
Remove virtualization of screen and display functions.
(#79990, patch from Erwann Chenede)
* gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c
gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}:
New files containing stub implementations of Display,
Screen functions.
* gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/x11/gdkx.h: Clean up function exports and what
headers they are in. (#79954)
* gdk/x11/gdkx.h: Fix macro that was referring to a non-existant
screen->screen_num. (In the patch for #79972, Erwann Chenede)
* gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h
gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer()
to use window hooks. (#79972, patch partly from Erwann Chenede)
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix
some warnings.
2002-06-06 00:26:42 +00:00
|
|
|
|
* in @value, %FALSE otherwise.
|
|
|
|
|
**/
|
|
|
|
|
gboolean
|
|
|
|
|
gdk_setting_get (const gchar *name,
|
|
|
|
|
GValue *value)
|
|
|
|
|
{
|
2002-06-20 23:59:27 +00:00
|
|
|
|
return gdk_screen_get_setting (gdk_screen_get_default (), name, value);
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
Changes multihead reorganizing code for win32 support,
mostly from a patch by Hans Breuer.
* gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c
gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c
gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c
gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c
gdk/gdkscreen.c gdk/x11/gdkmain-x11.c
gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c
gdk/x11/gdkpango-x11.c gdk/gdkselection.c
gdk/x11/gdkselection-x11.c gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c:
Move port-independent singlehead wrapper functions into
port-independent part of GDK. (#80009)
* gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c
gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c
gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c
gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c:
Turn singlehead functions into "multihead" functions that ignore
their GdkDisplay or GdkScreen arguments.
* gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h:
Misc multihead-compatibility changes.
* gtk/gtk.def gdk/gdk.def: Update for multihead functions.
* gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c
gdk/x11/gdkvisual-x11.c: Remove the screen fields
from the public parts of the colormap/visual structures, add accessors
instead.
* gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c
gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c
gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen
for colormaps, visuals; move the fields into the private
structures for the x11 backend.
* gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c:
Remove virtualization of screen and display functions.
(#79990, patch from Erwann Chenede)
* gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c
gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}:
New files containing stub implementations of Display,
Screen functions.
* gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/x11/gdkx.h: Clean up function exports and what
headers they are in. (#79954)
* gdk/x11/gdkx.h: Fix macro that was referring to a non-existant
screen->screen_num. (In the patch for #79972, Erwann Chenede)
* gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h
gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer()
to use window hooks. (#79972, patch partly from Erwann Chenede)
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix
some warnings.
2002-06-06 00:26:42 +00:00
|
|
|
|
}
|
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
|
|
|
|
*
|
|
|
|
|
* Since: 3.10
|
|
|
|
|
*/
|
|
|
|
|
GdkEventType
|
|
|
|
|
gdk_event_get_event_type (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (event != NULL, GDK_NOTHING);
|
|
|
|
|
|
|
|
|
|
return event->type;
|
|
|
|
|
}
|
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
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.20
|
|
|
|
|
**/
|
|
|
|
|
GdkSeat *
|
|
|
|
|
gdk_event_get_seat (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
const GdkEventPrivate *priv;
|
|
|
|
|
|
|
|
|
|
if (!gdk_event_is_allocated (event))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
priv = (const GdkEventPrivate *) event;
|
2015-12-16 18:00:39 +00:00
|
|
|
|
|
|
|
|
|
if (!priv->seat)
|
|
|
|
|
{
|
|
|
|
|
GdkDevice *device;
|
|
|
|
|
|
|
|
|
|
g_warning ("Event with type %d not holding a GdkSeat. "
|
2016-02-28 17:20:39 +00:00
|
|
|
|
"It is most likely synthesized outside Gdk/GTK+",
|
2015-12-16 18:00:39 +00:00
|
|
|
|
event->type);
|
|
|
|
|
|
|
|
|
|
device = gdk_event_get_device (event);
|
|
|
|
|
|
|
|
|
|
return device ? gdk_device_get_seat (device) : NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-26 18:53:09 +00:00
|
|
|
|
return priv->seat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_seat (GdkEvent *event,
|
|
|
|
|
GdkSeat *seat)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *priv;
|
|
|
|
|
|
|
|
|
|
if (gdk_event_is_allocated (event))
|
|
|
|
|
{
|
|
|
|
|
priv = (GdkEventPrivate *) event;
|
|
|
|
|
priv->seat = seat;
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
**/
|
|
|
|
|
GdkDeviceTool *
|
|
|
|
|
gdk_event_get_device_tool (const GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private;
|
|
|
|
|
|
|
|
|
|
if (!gdk_event_is_allocated (event))
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
private = (GdkEventPrivate *) event;
|
|
|
|
|
return private->tool;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
**/
|
|
|
|
|
void
|
|
|
|
|
gdk_event_set_device_tool (GdkEvent *event,
|
|
|
|
|
GdkDeviceTool *tool)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private;
|
|
|
|
|
|
|
|
|
|
if (!gdk_event_is_allocated (event))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
private = (GdkEventPrivate *) event;
|
|
|
|
|
private->tool = tool;
|
|
|
|
|
}
|
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
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private = (GdkEventPrivate *) event;
|
|
|
|
|
|
|
|
|
|
private->key_scancode = scancode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
|
|
|
|
*
|
|
|
|
|
* Since: 3.22
|
|
|
|
|
**/
|
|
|
|
|
int
|
|
|
|
|
gdk_event_get_scancode (GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
GdkEventPrivate *private;
|
|
|
|
|
|
|
|
|
|
if (!gdk_event_is_allocated (event))
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
private = (GdkEventPrivate *) event;
|
|
|
|
|
return private->key_scancode;
|
|
|
|
|
}
|