forked from AuroraMiddleware/gtk
x11: Add gdk_x11_display_get_max_request_size()
There's multiple places in the clipboard code where I need it, so make it a custom function.
This commit is contained in:
parent
8e132ef0c4
commit
c66a61d896
@ -54,12 +54,6 @@ struct _GdkX11ClipboardClass
|
|||||||
|
|
||||||
G_DEFINE_TYPE (GdkX11Clipboard, gdk_x11_clipboard, GDK_TYPE_CLIPBOARD)
|
G_DEFINE_TYPE (GdkX11Clipboard, gdk_x11_clipboard, GDK_TYPE_CLIPBOARD)
|
||||||
|
|
||||||
#define SELECTION_MAX_SIZE(display) \
|
|
||||||
MIN(262144, \
|
|
||||||
XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) == 0 \
|
|
||||||
? XMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100 \
|
|
||||||
: XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100)
|
|
||||||
|
|
||||||
static GInputStream *
|
static GInputStream *
|
||||||
text_list_convert (GdkX11Clipboard *cb,
|
text_list_convert (GdkX11Clipboard *cb,
|
||||||
GInputStream *stream,
|
GInputStream *stream,
|
||||||
@ -219,7 +213,7 @@ gdk_x11_clipboard_request_targets_finish (GObject *source_object,
|
|||||||
gdk_content_formats_unref (formats);
|
gdk_content_formats_unref (formats);
|
||||||
|
|
||||||
g_input_stream_read_bytes_async (stream,
|
g_input_stream_read_bytes_async (stream,
|
||||||
SELECTION_MAX_SIZE (display),
|
gdk_x11_display_get_max_request_size (display),
|
||||||
G_PRIORITY_DEFAULT,
|
G_PRIORITY_DEFAULT,
|
||||||
NULL,
|
NULL,
|
||||||
gdk_x11_clipboard_request_targets_finish,
|
gdk_x11_clipboard_request_targets_finish,
|
||||||
@ -255,7 +249,7 @@ gdk_x11_clipboard_request_targets_got_stream (GObject *source,
|
|||||||
display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
|
display = gdk_clipboard_get_display (GDK_CLIPBOARD (cb));
|
||||||
|
|
||||||
g_input_stream_read_bytes_async (stream,
|
g_input_stream_read_bytes_async (stream,
|
||||||
SELECTION_MAX_SIZE (display),
|
gdk_x11_display_get_max_request_size (display),
|
||||||
G_PRIORITY_DEFAULT,
|
G_PRIORITY_DEFAULT,
|
||||||
NULL,
|
NULL,
|
||||||
gdk_x11_clipboard_request_targets_finish,
|
gdk_x11_clipboard_request_targets_finish,
|
||||||
|
@ -3042,6 +3042,20 @@ gdk_x11_set_sm_client_id (const gchar *sm_client_id)
|
|||||||
g_slist_free (displays);
|
g_slist_free (displays);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gsize
|
||||||
|
gdk_x11_display_get_max_request_size (GdkDisplay *display)
|
||||||
|
{
|
||||||
|
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
||||||
|
gsize size;
|
||||||
|
|
||||||
|
size = XExtendedMaxRequestSize (xdisplay);
|
||||||
|
if (size <= 0)
|
||||||
|
size = XMaxRequestSize (xdisplay);
|
||||||
|
|
||||||
|
size = MIN (262144, size - 100);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
GdkX11Screen *
|
GdkX11Screen *
|
||||||
gdk_x11_display_get_screen (GdkDisplay *display)
|
gdk_x11_display_get_screen (GdkDisplay *display)
|
||||||
{
|
{
|
||||||
|
@ -172,6 +172,7 @@ GdkX11Screen *_gdk_x11_display_screen_for_xrootwin (GdkDisplay *display,
|
|||||||
Window xrootwin);
|
Window xrootwin);
|
||||||
void _gdk_x11_display_error_event (GdkDisplay *display,
|
void _gdk_x11_display_error_event (GdkDisplay *display,
|
||||||
XErrorEvent *error);
|
XErrorEvent *error);
|
||||||
|
gsize gdk_x11_display_get_max_request_size (GdkDisplay *display);
|
||||||
|
|
||||||
GdkFilterReturn _gdk_wm_protocols_filter (GdkXEvent *xev,
|
GdkFilterReturn _gdk_wm_protocols_filter (GdkXEvent *xev,
|
||||||
GdkEvent *event,
|
GdkEvent *event,
|
||||||
|
Loading…
Reference in New Issue
Block a user