Various bug fixes for multiple display support and drag and drop
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
#include "gdkx.h"
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <glib.h>
|
||||
#include "gdkx.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
#include "gdkscreen.h"
|
||||
#include "gdkscreen-x11.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
void gdk_x11_display_impl_class_init(GdkDisplayImplX11Class *class);
|
||||
|
||||
@@ -110,7 +114,7 @@ GdkScreen *gdk_x11_display_impl_get_screen(GdkDisplay *dpy,gint screen_num){
|
||||
while(tmp){
|
||||
if((((GdkScreenImplX11*)tmp->data)->xscreen) == desired_scr)
|
||||
{
|
||||
GdkScreenImplX11 *desired_screen = (GdkScreen*) tmp->data;
|
||||
GdkScreenImplX11 *desired_screen = (GdkScreenImplX11*) tmp->data;
|
||||
if(!desired_screen->visual_initialised)
|
||||
_gdk_visual_init((GdkScreen*) tmp->data);
|
||||
if(!desired_screen->colormap_initialised)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef __GDK_DISPLAY_X11__
|
||||
#define __GDK_DISPLAY_X11__
|
||||
|
||||
#include "config.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/*#include "gdkx.h"*/
|
||||
#include <glib.h>
|
||||
#include "gdkdisplaymgr.h"
|
||||
#include "gdkdisplaymgr-x11.h"
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -24,6 +24,13 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# if STDC_HEADERS
|
||||
# include <string.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "gdk.h"
|
||||
#include "gdkprivate-x11.h"
|
||||
#include "gdkinternals.h"
|
||||
@@ -35,12 +42,6 @@
|
||||
|
||||
#include "xsettings-client.h"
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# if STDC_HEADERS
|
||||
# include <string.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "gdkinputprivate.h"
|
||||
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xos.h>
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
@@ -40,7 +43,6 @@
|
||||
#include "gdkscreen-x11.h"
|
||||
#include "gdkdisplay-x11.h"
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_XKB
|
||||
#include <X11/XKBlib.h>
|
||||
#endif /* HAVE_XKB */
|
||||
|
||||
@@ -24,7 +24,9 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xatom.h>
|
||||
@@ -447,8 +450,8 @@ gdk_text_property_to_utf8_list_for_display (GdkDisplay *display,
|
||||
/*
|
||||
Probably COMPOUND text, we fall back to Xlib routines
|
||||
*/
|
||||
local_count = gdk_text_property_to_text_list_for_display (encoding,
|
||||
display,
|
||||
local_count = gdk_text_property_to_text_list_for_display (display,
|
||||
encoding,
|
||||
format,
|
||||
text,
|
||||
length,
|
||||
|
||||
@@ -24,12 +24,14 @@
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <netinet/in.h>
|
||||
#include "gdk.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkwindow.h"
|
||||
#include "gdkinputprivate.h"
|
||||
@@ -3662,6 +3664,8 @@ update_pos_for_display (GdkDisplay *display,
|
||||
w += dx;
|
||||
h += dy;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
w = MAX (w, 1);
|
||||
|
||||
@@ -315,8 +315,8 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
|
||||
{
|
||||
ensure_clipboard_widget ();
|
||||
|
||||
if (gtk_selection_owner_set_for_display (clipboard_widget,
|
||||
clipboard->display,
|
||||
if (gtk_selection_owner_set_for_display (clipboard->display,
|
||||
clipboard_widget,
|
||||
clipboard->selection,
|
||||
clipboard_get_timestamp (clipboard)))
|
||||
{
|
||||
@@ -501,8 +501,8 @@ gtk_clipboard_clear (GtkClipboard *clipboard)
|
||||
g_return_if_fail (clipboard != NULL);
|
||||
|
||||
if (clipboard->have_selection)
|
||||
gtk_selection_owner_set_for_display (NULL,
|
||||
clipboard->display,
|
||||
gtk_selection_owner_set_for_display (clipboard->display,
|
||||
NULL,
|
||||
clipboard->selection,
|
||||
clipboard_get_timestamp (clipboard));
|
||||
}
|
||||
|
||||
@@ -2317,8 +2317,8 @@ gtk_drag_source_check_selection (GtkDragSourceInfo *info,
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
gtk_selection_owner_set_for_display (info->ipc_widget,
|
||||
display,
|
||||
gtk_selection_owner_set_for_display (display,
|
||||
info->ipc_widget,
|
||||
selection,
|
||||
time);
|
||||
info->selections = g_list_prepend (info->selections,
|
||||
@@ -2423,8 +2423,7 @@ gtk_drag_source_release_selections (GtkDragSourceInfo *info,
|
||||
{
|
||||
GdkAtom selection = GPOINTER_TO_UINT (tmp_list->data);
|
||||
if (gdk_selection_owner_get_for_display (gdk_window_get_display(info->ipc_widget->window), selection) == info->ipc_widget->window)
|
||||
gtk_selection_owner_set_for_display (NULL,
|
||||
gdk_window_get_display(info->ipc_widget->window), selection, time);
|
||||
gtk_selection_owner_set_for_display (gdk_window_get_display(info->ipc_widget->window), NULL, selection, time);
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
@@ -763,16 +763,16 @@ gtk_old_editable_claim_selection (GtkOldEditable *old_editable,
|
||||
|
||||
if (claim)
|
||||
{
|
||||
if (gtk_selection_owner_set_for_display (GTK_WIDGET (old_editable),
|
||||
GTK_WIDGET_GET_DISPLAY(old_editable),
|
||||
if (gtk_selection_owner_set_for_display (GTK_WIDGET_GET_DISPLAY(old_editable),
|
||||
GTK_WIDGET (old_editable),
|
||||
GDK_SELECTION_PRIMARY, time))
|
||||
old_editable->has_selection = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gdk_selection_owner_get_for_display (GTK_WIDGET_GET_DISPLAY(old_editable),GDK_SELECTION_PRIMARY) == GTK_WIDGET (old_editable)->window)
|
||||
gtk_selection_owner_set_for_display (NULL,
|
||||
GTK_WIDGET_GET_DISPLAY(old_editable),
|
||||
gtk_selection_owner_set_for_display (GTK_WIDGET_GET_DISPLAY(old_editable),
|
||||
NULL,
|
||||
GDK_SELECTION_PRIMARY, time);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +595,10 @@ gtk_selection_add_targets (GtkWidget *widget,
|
||||
g_return_if_fail (targets != NULL);
|
||||
|
||||
list = gtk_selection_target_list_get (widget, selection);
|
||||
gtk_target_list_add_table (list, targets, ntargets);
|
||||
gtk_target_list_add_table_for_display (list,
|
||||
GTK_WIDGET_GET_DISPLAY(widget),
|
||||
targets,
|
||||
ntargets);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "gtktextbtree.h"
|
||||
#include "gtktextiterprivate.h"
|
||||
#include <string.h>
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
typedef struct _ClipboardRequest ClipboardRequest;
|
||||
|
||||
@@ -300,6 +301,7 @@ void
|
||||
gtk_text_buffer_init (GtkTextBuffer *buffer)
|
||||
{
|
||||
buffer->clipboard_contents = NULL;
|
||||
buffer->clipboard_display = DEFAULT_GDK_DISPLAY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2855,7 +2857,7 @@ gtk_text_buffer_update_primary_selection (GtkTextBuffer *buffer)
|
||||
GtkTextIter end;
|
||||
|
||||
GtkClipboard *clipboard = gtk_clipboard_get_for_display (GDK_SELECTION_PRIMARY,
|
||||
GTK_WIDGET_GET_DISPLAY(buffer));
|
||||
buffer->clipboard_display);
|
||||
|
||||
/* Determine whether we have a selection and adjust X selection
|
||||
* accordingly.
|
||||
@@ -2888,7 +2890,7 @@ paste (GtkTextBuffer *buffer,
|
||||
ClipboardRequest *data = g_new (ClipboardRequest, 1);
|
||||
GtkTextIter paste_point;
|
||||
GtkTextIter start, end;
|
||||
GdkDisplay *display = gdk_screen_get_display(GTK_WIDGET(buffer)->screen);
|
||||
GdkDisplay *display = buffer->clipboard_display;
|
||||
|
||||
data->buffer = buffer;
|
||||
g_object_ref (G_OBJECT (buffer));
|
||||
@@ -3045,7 +3047,7 @@ cut_or_copy (GtkTextBuffer *buffer,
|
||||
if (!gtk_text_iter_equal (&start, &end))
|
||||
{
|
||||
GtkClipboard *clipboard = gtk_clipboard_get_for_display (GDK_NONE,
|
||||
GTK_WIDGET_GET_DISPLAY(buffer));
|
||||
buffer->clipboard_display);
|
||||
GtkTextIter ins;
|
||||
|
||||
buffer->clipboard_contents =
|
||||
@@ -3342,6 +3344,47 @@ _gtk_text_buffer_get_line_log_attrs (GtkTextBuffer *buffer,
|
||||
return cache->entries[0].attrs;
|
||||
}
|
||||
|
||||
|
||||
GtkTextBuffer*
|
||||
gtk_text_buffer_new_for_display (GdkDisplay *clipboard_display,
|
||||
GtkTextTagTable *table)
|
||||
{
|
||||
GtkTextBuffer *text_buffer;
|
||||
|
||||
text_buffer = GTK_TEXT_BUFFER (g_object_new (gtk_text_buffer_get_type (), NULL));
|
||||
|
||||
if (table)
|
||||
{
|
||||
text_buffer->tag_table = table;
|
||||
|
||||
g_object_ref (G_OBJECT (text_buffer->tag_table));
|
||||
}
|
||||
|
||||
text_buffer->clipboard_display = clipboard_display;
|
||||
|
||||
g_object_ref (G_OBJECT (text_buffer));
|
||||
|
||||
return text_buffer;
|
||||
|
||||
|
||||
}
|
||||
void
|
||||
gtk_text_buffer_set_clipboard_display (GtkTextBuffer *buffer,
|
||||
GdkDisplay *clipboard_display)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
|
||||
g_return_if_fail (clipboard_display != NULL);
|
||||
buffer->clipboard_display = clipboard_display;
|
||||
}
|
||||
|
||||
GdkDisplay* gtk_text_buffer_get_clipboard_display (GtkTextBuffer *buffer)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
|
||||
return buffer->clipboard_display;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Debug spew
|
||||
*/
|
||||
|
||||
@@ -67,6 +67,8 @@ struct _GtkTextBuffer
|
||||
GtkTextLogAttrCache *log_attr_cache;
|
||||
|
||||
guint user_action_count;
|
||||
|
||||
GdkDisplay *clipboard_display;
|
||||
|
||||
/* Whether the buffer has been modified since last save */
|
||||
guint modified : 1;
|
||||
@@ -342,6 +344,14 @@ gboolean gtk_text_buffer_delete_selection (GtkTextBuffer *buffer,
|
||||
void gtk_text_buffer_begin_user_action (GtkTextBuffer *buffer);
|
||||
void gtk_text_buffer_end_user_action (GtkTextBuffer *buffer);
|
||||
|
||||
/* Called for multiple display applications */
|
||||
GtkTextBuffer* gtk_text_buffer_new_for_display (GdkDisplay *clipboard_display,
|
||||
GtkTextTagTable *table);
|
||||
void gtk_text_buffer_set_clipboard_display (GtkTextBuffer *buffer,
|
||||
GdkDisplay *clipboard_display);
|
||||
GdkDisplay* gtk_text_buffer_get_clipboard_display (GtkTextBuffer *buffer);
|
||||
|
||||
|
||||
/* INTERNAL private stuff */
|
||||
void _gtk_text_buffer_spew (GtkTextBuffer *buffer);
|
||||
|
||||
|
||||
@@ -3,19 +3,19 @@
|
||||
#include <gdk/gdkinternals.h>
|
||||
|
||||
void
|
||||
hello (void)
|
||||
hello (GtkWidget *widget)
|
||||
{
|
||||
g_print ("hello world\n");
|
||||
GdkScreen *scr = gtk_widget_get_screen(widget);
|
||||
GdkDisplay *dpy = gdk_screen_get_display(scr);
|
||||
g_print("Click from %s\n",gdk_display_get_name(dpy));
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
GtkWidget *window, *win2;
|
||||
GtkWidget *button, *butt2;
|
||||
GtkWidget *window, *win2, *button, *butt2, *dialog;
|
||||
GdkDisplay *dpy2;
|
||||
GdkScreen *scr2;
|
||||
GtkButton *toto;
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
/* Crude test insert 2nd machine name here */
|
||||
@@ -39,7 +39,7 @@ main (int argc, char *argv[])
|
||||
"GtkWidget::parent", win2,
|
||||
"GtkWidget::visible", TRUE,
|
||||
NULL),
|
||||
"signal::clicked", hello, NULL,
|
||||
"signal::clicked", hello, win2,
|
||||
NULL);
|
||||
window = g_object_connect (gtk_widget_new (gtk_window_get_type (),
|
||||
"user_data", NULL,
|
||||
@@ -56,7 +56,7 @@ main (int argc, char *argv[])
|
||||
"GtkWidget::parent", window,
|
||||
"GtkWidget::visible", TRUE,
|
||||
NULL),
|
||||
"signal::clicked", hello, NULL,
|
||||
"signal::clicked", hello, window,
|
||||
NULL);
|
||||
|
||||
gtk_widget_show (window);
|
||||
|
||||
Reference in New Issue
Block a user