[broadway] Break out _gdk_broadway_display_read_all_input_nonblocking
This is useful in other places, like when we want to iterate over all messages recieved so far.
This commit is contained in:
parent
d664e78c94
commit
ee1657d88e
@ -298,17 +298,30 @@ parse_input (BroadwayInput *input)
|
|||||||
g_byte_array_remove_range (input->buffer, 0, buf - (char *)input->buffer->data);
|
g_byte_array_remove_range (input->buffer, 0, buf - (char *)input->buffer->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
input_data_cb (GObject *stream,
|
process_input_idle_cb (GdkBroadwayDisplay *display)
|
||||||
BroadwayInput *input)
|
{
|
||||||
|
process_input_messages (display);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_gdk_broadway_display_read_all_input_nonblocking (GdkDisplay *display )
|
||||||
{
|
{
|
||||||
GdkBroadwayDisplay *broadway_display;
|
GdkBroadwayDisplay *broadway_display;
|
||||||
GInputStream *in;
|
GInputStream *in;
|
||||||
gssize res;
|
gssize res;
|
||||||
guint8 buffer[1024];
|
guint8 buffer[1024];
|
||||||
GError *error;
|
GError *error;
|
||||||
|
BroadwayInput *input;
|
||||||
|
|
||||||
|
broadway_display = GDK_BROADWAY_DISPLAY (display);
|
||||||
|
if (broadway_display->input == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
input = broadway_display->input;
|
||||||
|
|
||||||
broadway_display = GDK_BROADWAY_DISPLAY (input->display);
|
|
||||||
in = g_io_stream_get_input_stream (G_IO_STREAM (input->connection));
|
in = g_io_stream_get_input_stream (G_IO_STREAM (input->connection));
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
@ -321,7 +334,7 @@ input_data_cb (GObject *stream,
|
|||||||
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
|
g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
|
||||||
{
|
{
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
return TRUE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
broadway_display->input = NULL;
|
broadway_display->input = NULL;
|
||||||
@ -331,22 +344,26 @@ input_data_cb (GObject *stream,
|
|||||||
g_print ("input error %s", error->message);
|
g_print ("input error %s", error->message);
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
}
|
}
|
||||||
return FALSE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_byte_array_append (input->buffer, buffer, res);
|
g_byte_array_append (input->buffer, buffer, res);
|
||||||
|
|
||||||
parse_input (input);
|
parse_input (input);
|
||||||
process_input_messages (broadway_display);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
process_input_idle_cb (GdkBroadwayDisplay *display)
|
input_data_cb (GObject *stream,
|
||||||
|
BroadwayInput *input)
|
||||||
{
|
{
|
||||||
process_input_messages (display);
|
GdkBroadwayDisplay *broadway_display;
|
||||||
return FALSE;
|
|
||||||
|
broadway_display = GDK_BROADWAY_DISPLAY (input->display);
|
||||||
|
_gdk_broadway_display_read_all_input_nonblocking (input->display);
|
||||||
|
|
||||||
|
process_input_messages (broadway_display);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: This may be called while handling a message (i.e. sorta recursively) */
|
/* Note: This may be called while handling a message (i.e. sorta recursively) */
|
||||||
|
Loading…
Reference in New Issue
Block a user