mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-24 12:41:16 +00:00
Remove gdk_input_* callbacks on file descriptors deprecated functions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=619687
This commit is contained in:
parent
3c8a54b2f7
commit
349f8c561d
@ -81,7 +81,6 @@ gdk_grab_ownership_get_type
|
||||
gdk_grab_status_get_type
|
||||
gdk_gravity_get_type
|
||||
gdk_image_type_get_type
|
||||
gdk_input_condition_get_type
|
||||
gdk_input_mode_get_type
|
||||
gdk_input_source_get_type
|
||||
gdk_join_style_get_type
|
||||
@ -1221,18 +1220,6 @@ GDK_TYPE_CURSOR
|
||||
gdk_cursor_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Input</TITLE>
|
||||
<FILE>input</FILE>
|
||||
gdk_input_add_full
|
||||
GdkInputCondition
|
||||
GdkInputFunction
|
||||
gdk_input_add
|
||||
gdk_input_remove
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_TYPE_INPUT_CONDITION
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Drag and Drop</TITLE>
|
||||
|
@ -1,96 +0,0 @@
|
||||
<!-- ##### SECTION Title ##### -->
|
||||
Input
|
||||
|
||||
<!-- ##### SECTION Short_Description ##### -->
|
||||
Callbacks on file descriptors
|
||||
|
||||
<!-- ##### SECTION Long_Description ##### -->
|
||||
<para>
|
||||
The functions in this section are used to establish
|
||||
callbacks when some condition becomes true for
|
||||
a file descriptor. They are currently just wrappers around
|
||||
the <link linkend="glib-IO-Channels">IO Channel</link>
|
||||
facility.
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION See_Also ##### -->
|
||||
<para>
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term><link linkend="glib-The-Main-Event-Loop">GLib Main Loop</link></term>
|
||||
<listitem><para>The main loop in which input callbacks run.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><link linkend="glib-IO-Channels">IO Channels</link></term>
|
||||
<listitem><para>A newer and more flexible way of doing IO
|
||||
callbacks.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
<!-- ##### SECTION Stability_Level ##### -->
|
||||
|
||||
|
||||
<!-- ##### SECTION Image ##### -->
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_input_add_full ##### -->
|
||||
|
||||
|
||||
@source:
|
||||
@condition:
|
||||
@function:
|
||||
@data:
|
||||
@destroy:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### ENUM GdkInputCondition ##### -->
|
||||
<para>
|
||||
A set of bit flags used to specify conditions for which
|
||||
an input callback will be triggered. The three members
|
||||
of this enumeration correspond to the @readfds,
|
||||
@writefds, and @exceptfds arguments to the
|
||||
<function>select</function> system call.
|
||||
</para>
|
||||
|
||||
@GDK_INPUT_READ: the file descriptor has become available for reading.
|
||||
(Or, as is standard in Unix, a socket or pipe was closed
|
||||
at the other end; this is the case if a subsequent read
|
||||
on the file descriptor returns a count of zero.)
|
||||
@GDK_INPUT_WRITE: the file descriptor has become available for writing.
|
||||
@GDK_INPUT_EXCEPTION: an exception was raised on the file descriptor.
|
||||
|
||||
<!-- ##### USER_FUNCTION GdkInputFunction ##### -->
|
||||
<para>
|
||||
A callback function that will be called when some condition
|
||||
occurs.
|
||||
</para>
|
||||
|
||||
@data: the user data passed to gdk_input_add() or gdk_input_add_full().
|
||||
@source: the source where the condition occurred.
|
||||
@condition: the triggering condition.
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_input_add ##### -->
|
||||
|
||||
|
||||
@source:
|
||||
@condition:
|
||||
@function:
|
||||
@data:
|
||||
@Returns:
|
||||
|
||||
|
||||
<!-- ##### FUNCTION gdk_input_remove ##### -->
|
||||
<para>
|
||||
Remove a callback added with gdk_input_add() or
|
||||
gdk_input_add_full().
|
||||
</para>
|
||||
|
||||
@tag: the tag returned when the callback was set up.
|
||||
|
||||
|
16
gdk/gdk.h
16
gdk/gdk.h
@ -91,22 +91,6 @@ gint gdk_error_trap_pop (void);
|
||||
gchar* gdk_get_display (void);
|
||||
G_CONST_RETURN gchar* gdk_get_display_arg_name (void);
|
||||
|
||||
#if !defined (GDK_DISABLE_DEPRECATED) || defined (GTK_COMPILATION)
|
||||
/* Used by gtk_input_add_full () */
|
||||
gint gdk_input_add_full (gint source,
|
||||
GdkInputCondition condition,
|
||||
GdkInputFunction function,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy);
|
||||
#endif /* !GDK_DISABLE_DEPRECATED || GTK_COMPILATION */
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
gint gdk_input_add (gint source,
|
||||
GdkInputCondition condition,
|
||||
GdkInputFunction function,
|
||||
gpointer data);
|
||||
void gdk_input_remove (gint tag);
|
||||
#endif /* GDK_DISABLE_DEPRECATED */
|
||||
|
||||
#ifndef GDK_MULTIDEVICE_SAFE
|
||||
GdkGrabStatus gdk_pointer_grab (GdkWindow *window,
|
||||
gboolean owner_events,
|
||||
|
@ -194,16 +194,6 @@ gdk_threads_add_timeout_seconds_full
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_H__)
|
||||
#if IN_FILE(__GDK_EVENTS_C__)
|
||||
#ifndef GDK_DISABLE_DEPRECATED
|
||||
gdk_input_add
|
||||
gdk_input_remove
|
||||
gdk_input_add_full
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IN_HEADER(__GDK_H__)
|
||||
#if IN_FILE(__GDK_SCREEN_C__)
|
||||
gdk_screen_width G_GNUC_CONST
|
||||
@ -258,7 +248,6 @@ gdk_utf8_to_compound_text_for_display
|
||||
gdk_rgb_dither_get_type G_GNUC_CONST
|
||||
gdk_drag_protocol_get_type G_GNUC_CONST
|
||||
gdk_input_source_get_type G_GNUC_CONST
|
||||
gdk_input_condition_get_type G_GNUC_CONST
|
||||
gdk_input_mode_get_type G_GNUC_CONST
|
||||
gdk_axis_use_get_type G_GNUC_CONST
|
||||
gdk_byte_order_get_type G_GNUC_CONST
|
||||
|
114
gdk/gdkevents.c
114
gdk/gdkevents.c
@ -36,8 +36,6 @@ typedef struct _GdkIOClosure GdkIOClosure;
|
||||
|
||||
struct _GdkIOClosure
|
||||
{
|
||||
GdkInputFunction function;
|
||||
GdkInputCondition condition;
|
||||
GDestroyNotify notify;
|
||||
gpointer data;
|
||||
};
|
||||
@ -1313,124 +1311,12 @@ gdk_get_show_events (void)
|
||||
return (_gdk_debug_flags & GDK_DEBUG_EVENTS) != 0;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_io_destroy (gpointer data)
|
||||
{
|
||||
GdkIOClosure *closure = data;
|
||||
|
||||
if (closure->notify)
|
||||
closure->notify (closure->data);
|
||||
|
||||
g_free (closure);
|
||||
}
|
||||
|
||||
/* What do we do with G_IO_NVAL?
|
||||
*/
|
||||
#define READ_CONDITION (G_IO_IN | G_IO_HUP | G_IO_ERR)
|
||||
#define WRITE_CONDITION (G_IO_OUT | G_IO_ERR)
|
||||
#define EXCEPTION_CONDITION (G_IO_PRI)
|
||||
|
||||
static gboolean
|
||||
gdk_io_invoke (GIOChannel *source,
|
||||
GIOCondition condition,
|
||||
gpointer data)
|
||||
{
|
||||
GdkIOClosure *closure = data;
|
||||
GdkInputCondition gdk_cond = 0;
|
||||
|
||||
if (condition & READ_CONDITION)
|
||||
gdk_cond |= GDK_INPUT_READ;
|
||||
if (condition & WRITE_CONDITION)
|
||||
gdk_cond |= GDK_INPUT_WRITE;
|
||||
if (condition & EXCEPTION_CONDITION)
|
||||
gdk_cond |= GDK_INPUT_EXCEPTION;
|
||||
|
||||
if (closure->condition & gdk_cond)
|
||||
closure->function (closure->data, g_io_channel_unix_get_fd (source), gdk_cond);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_input_add_full:
|
||||
* @source: a file descriptor.
|
||||
* @condition: the condition.
|
||||
* @function: the callback function.
|
||||
* @data: callback data passed to @function.
|
||||
* @destroy: callback function to call with @data when the input
|
||||
* handler is removed.
|
||||
*
|
||||
* Establish a callback when a condition becomes true on
|
||||
* a file descriptor.
|
||||
*
|
||||
* Returns: a tag that can later be used as an argument to
|
||||
* gdk_input_remove().
|
||||
*
|
||||
* Deprecated: 2.14: Use g_io_add_watch_full() on a #GIOChannel
|
||||
*/
|
||||
gint
|
||||
gdk_input_add_full (gint source,
|
||||
GdkInputCondition condition,
|
||||
GdkInputFunction function,
|
||||
gpointer data,
|
||||
GDestroyNotify destroy)
|
||||
{
|
||||
guint result;
|
||||
GdkIOClosure *closure = g_new (GdkIOClosure, 1);
|
||||
GIOChannel *channel;
|
||||
GIOCondition cond = 0;
|
||||
|
||||
closure->function = function;
|
||||
closure->condition = condition;
|
||||
closure->notify = destroy;
|
||||
closure->data = data;
|
||||
|
||||
if (condition & GDK_INPUT_READ)
|
||||
cond |= READ_CONDITION;
|
||||
if (condition & GDK_INPUT_WRITE)
|
||||
cond |= WRITE_CONDITION;
|
||||
if (condition & GDK_INPUT_EXCEPTION)
|
||||
cond |= EXCEPTION_CONDITION;
|
||||
|
||||
channel = g_io_channel_unix_new (source);
|
||||
result = g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, cond,
|
||||
gdk_io_invoke,
|
||||
closure, gdk_io_destroy);
|
||||
g_io_channel_unref (channel);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_input_add:
|
||||
* @source: a file descriptor.
|
||||
* @condition: the condition.
|
||||
* @function: the callback function.
|
||||
* @data: callback data passed to @function.
|
||||
*
|
||||
* Establish a callback when a condition becomes true on
|
||||
* a file descriptor.
|
||||
*
|
||||
* Returns: a tag that can later be used as an argument to
|
||||
* gdk_input_remove().
|
||||
*
|
||||
* Deprecated: 2.14: Use g_io_add_watch() on a #GIOChannel
|
||||
*/
|
||||
gint
|
||||
gdk_input_add (gint source,
|
||||
GdkInputCondition condition,
|
||||
GdkInputFunction function,
|
||||
gpointer data)
|
||||
{
|
||||
return gdk_input_add_full (source, condition, function, data, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_input_remove (gint tag)
|
||||
{
|
||||
g_source_remove (tag);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_synthesize_click (GdkDisplay *display,
|
||||
GdkEvent *event,
|
||||
|
@ -200,13 +200,6 @@ typedef enum
|
||||
GDK_MODIFIER_MASK = 0x5c001fff
|
||||
} GdkModifierType;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_INPUT_READ = 1 << 0,
|
||||
GDK_INPUT_WRITE = 1 << 1,
|
||||
GDK_INPUT_EXCEPTION = 1 << 2
|
||||
} GdkInputCondition;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_OK = 0,
|
||||
@ -273,10 +266,6 @@ typedef enum
|
||||
GDK_ALL_EVENTS_MASK = 0x3FFFFE
|
||||
} GdkEventMask;
|
||||
|
||||
typedef void (*GdkInputFunction) (gpointer data,
|
||||
gint source,
|
||||
GdkInputCondition condition);
|
||||
|
||||
struct _GdkPoint
|
||||
{
|
||||
gint x;
|
||||
|
Loading…
Reference in New Issue
Block a user