Commit 4632fb81 authored by Alex Larsson's avatar Alex Larsson Committed by Owen Taylor

Integrate Erwann Chenede's multihead changes for the gtk/ directory.

Mon Apr 29 18:28:00 2002  Owen Taylor  <otaylor@redhat.com>

	Integrate Erwann Chenede's multihead changes for the gtk/ directory.

	* gtk/gtkclipboard.[ch]: Add gtk_clipboard_get_for_display(),
	make internals multihead aware.

	* gtk/gtkcolorsel.[ch]: Add
	gtk_color_selection_set_change_palette_with_screen_hook () [ugh!]
	make up for non-multihead safety of
	gtk_color_selection_set_change_palette_hook()

	* gtk/gtkinvisible.[ch] gtk/gtkmenu.[ch] gtkwindow.[ch]: Add
	gtk_{invisible,menu,window}_set_screen(); add "screen" properties
	for GtkWindow and GtkMenu.

	* gtk/gtkplug.[ch]: Add gtk_plug_construct_for_display(),
	gtk_plug_new_for_display(). Multihead fixes.

	* gtk/gtkselection.[ch]: Add gtk_selection_owner_set_for_display(),
	make internals multihead aware.

	* gtk/gtksettings.[ch]: Add gtk_settings_get_for_screen(), get
	rid of now-useless gtk_settings_constructor().

	* gtk/gtkstyle.[ch]: Add gtk_style_get_font_for_display(), fix
	check/radio button indicators bitmap handling to be multihead
	safe.

	* gtk/gtkwidget.[ch]: Add gtk_widget_get_screen(), gtk_widget_has_screen(),
	gtk_widget_get_display(), gtk_widget_get_clipboard(),
	gtk_widget_get_root_window().

	* gtk/gtkbindings.c gtk/gtkbutton.c gtk/gtkclist.c gtk/gtkcombo.c
	gtk/gtkctree.c gtk/gtkdnd.c gtk/gtkfilesel.c gtk/gtkgamma.c
	gtk/gtkhandlebox.c gtk/gtkhsv.c gtk/gtkimcontext.c gtk/gtklabel.c
	gtk/gtklist.c gtk/gtkmain.c gtk/gtkmenuitem.c gtk/gtkmenushell.c
	gtk/gtknotebook.c gtk/gtkoldeditable.c gtk/gtkoptionmenu.c
	gtk/gtkpaned.c gtk/gtkpreview.c gtk/gtksocket.c gtk/gtktext.c
	gtk/gtktextbuffer.c gtk/gtktextview.c gtk/gtktipsquery.c
	gtk/gtktooltips.c gtk/gtktreeview.c gtk/gtktreeviewcolumn.c:
	misc mechanical multihead-safety fixes.

	* gtk/gtkclipboard.c: Use a GtkImage rather than a pixmap for
	the dropper, look up the color palette only at realization time,
	other multihead fixes.

	* gtk/gtkcombo.c (gtk_combo_unrealize): Popdown the list when
	unrealizing.

	* gtk/gtkentry.c: Only claim ownership of the primary selection
	when realized, misc multihead fixes.

	* gtk/gtkfontsel.c: Only fill in fonts when attached to a screen,
	fix gtk_font_selection_get_font() for multihead.

	* gtk/gtkgc.c: make the depth => drawable hash per-screen.

	* gtk/gtkinvisible.c: Add a constructor that realizes the
	widget, so we get a realized widget with g_object_new() as
	well gtk_invisible_new() as before.

	* gtk/gtkmain.c: Get rid of unused gtk_visual/gtk_colormap
	variables.

	* gtk/gtktextdisplay.c: Add warnings if stipple bitmaps
	are used on the wrong screen.

	* gtk/gtktoolbar.c: Make handling of GtkSettings-based layout
	read properties and connect to settings when the screen is changed,
	rather than on init/finalize.

	* gtk/gtkwindow.c: Fix icon handing to be multihead safe ...
	default icon pixmaps/mask are only shared between windows on the
	same screen. Misc multihead fixes.

Sat Apr 27 13:49:53 2002  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkclipboard.c (gtk_clipboard_get_for_display):
	Update docs to reference GDK_SELECTION_CLIPBOARD rather GDK_NONE.

2002-04-29  Alex Larsson  <alexl@redhat.com>

	* gdk/linux-fb/gdkproperty-fb.c (gdk_property_get):
	Fix silly bug, noticed by Sven Neumann.

Sun Apr 28 22:43:55 2002  Jonathan Blandford  <jrb@gnome.org>

	* gtk/gtktreemodelsort.c (gtk_tree_model_sort_set_sort_func): Fix
	so that you can set a new sort func.
parent bc25b9b2
......@@ -27,9 +27,8 @@ The #GtkInvisible-struct struct contains no public fields.
<!-- ##### FUNCTION gtk_invisible_new ##### -->
<para>
Creates a new #GtkInvisible.
</para>
@Returns: a new #GtkInvisible.
@Returns:
......@@ -36,20 +36,14 @@ inside the first applications window.
<!-- ##### FUNCTION gtk_plug_construct ##### -->
<para>
Finishes the creation of a #GtkPlug widget. This function
will generally only be used by classes deriving
from #GtkPlug.
</para>
@plug: a #GtkPlug widget.
@socket_id: the window ID of the socket.
@plug:
@socket_id:
<!-- ##### FUNCTION gtk_plug_new ##### -->
<para>
Creates a new plug widget inside the #GtkSocket identified
by @socket_id. If @socket_id is 0, the plug is left "unplugged" and
can later be plugged into a #GtkSocket by gtk_socket_add_id().
</para>
@socket_id: the window ID of the socket, or 0.
......
......@@ -1076,6 +1076,7 @@ gtk_bindings_activate (GtkObject *object,
GdkModifierType modifiers)
{
GSList *entries = NULL;
GdkDisplay *display;
GtkKeyHash *key_hash;
gboolean handled = FALSE;
gboolean is_release;
......@@ -1088,7 +1089,9 @@ gtk_bindings_activate (GtkObject *object,
is_release = (modifiers & GDK_RELEASE_MASK) != 0;
modifiers = modifiers & BINDING_MOD_MASK () & ~GDK_RELEASE_MASK;
key_hash = binding_key_hash_for_keymap (gdk_keymap_get_default ());
display = gtk_widget_get_display (GTK_WIDGET (object));
key_hash = binding_key_hash_for_keymap (gdk_keymap_get_for_display (display));
entries = _gtk_key_hash_lookup_keyval (key_hash, keyval, modifiers);
handled = gtk_bindings_activate_list (object, entries, is_release);
......@@ -1113,6 +1116,7 @@ _gtk_bindings_activate_event (GtkObject *object,
GdkEventKey *event)
{
GSList *entries = NULL;
GdkDisplay *display;
GtkKeyHash *key_hash;
gboolean handled = FALSE;
......@@ -1121,7 +1125,9 @@ _gtk_bindings_activate_event (GtkObject *object,
if (!GTK_IS_WIDGET (object))
return FALSE;
key_hash = binding_key_hash_for_keymap (gdk_keymap_get_default ());
display = gtk_widget_get_display (GTK_WIDGET (object));
key_hash = binding_key_hash_for_keymap (gdk_keymap_get_for_display (display));
entries = _gtk_key_hash_lookup (key_hash,
event->hardware_keycode,
event->state & BINDING_MOD_MASK () & ~GDK_RELEASE_MASK,
......
......@@ -1084,7 +1084,8 @@ gtk_button_finish_activate (GtkButton *button,
g_source_remove (button->activate_timeout);
button->activate_timeout = 0;
gdk_keyboard_ungrab (gtk_get_current_event_time ());
gdk_display_keyboard_ungrab (gtk_widget_get_display (widget),
gtk_get_current_event_time ());
gtk_grab_remove (widget);
button->button_down = FALSE;
......
......@@ -49,6 +49,7 @@ struct _GtkClipboard
guint32 timestamp;
gboolean have_selection;
GdkDisplay *display;
};
struct _RequestContentsInfo
......@@ -68,9 +69,6 @@ static void selection_received (GtkWidget *widget,
GtkSelectionData *selection_data,
guint time);
static GSList *clipboards;
static GtkWidget *clipboard_widget;
enum {
TARGET_STRING,
TARGET_TEXT,
......@@ -84,15 +82,17 @@ static GQuark request_contents_key_id = 0;
static const gchar *clipboards_owned_key = "gtk-clipboards-owned";
static GQuark clipboards_owned_key_id = 0;
/**
* gtk_clipboard_get:
* gtk_clipboard_get_for_display:
* @display: the display for which the clipboard is to be retrieved or created
* @selection: a #GdkAtom which identifies the clipboard
* to use.
*
* Returns the clipboard object for the given selection.
* Cut/copy/paste menu items and keyboard shortcuts should use
* the default clipboard, returned by passing #GDK_NONE for @selection.
* the default clipboard, returned by passing %GDK_SELECTION_CLIPBOARD for @selection.
* (%GDK_NONE is supported as a synonym for GDK_SELECTION_CLIPBOARD
* for backwards compatibility reasons.)
* The currently-selected object or text should be provided on the clipboard
* identified by #GDK_SELECTION_PRIMARY. Cut/copy/paste menu items
* conceptually copy the contents of the #GDK_SELECTION_PRIMARY clipboard
......@@ -121,13 +121,18 @@ static GQuark clipboards_owned_key_id = 0;
* cannot be freed.
**/
GtkClipboard *
gtk_clipboard_get (GdkAtom selection)
gtk_clipboard_get_for_display (GdkDisplay *display, GdkAtom selection)
{
GtkClipboard *clipboard = NULL;
GSList *clipboards;
GSList *tmp_list;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
if (selection == GDK_NONE)
selection = gdk_atom_intern ("CLIPBOARD", FALSE);
selection = GDK_SELECTION_CLIPBOARD;
clipboards = g_object_get_data (G_OBJECT (display), "gtk-clipboard-list");
tmp_list = clipboards;
while (tmp_list)
......@@ -143,19 +148,41 @@ gtk_clipboard_get (GdkAtom selection)
{
clipboard = g_new0 (GtkClipboard, 1);
clipboard->selection = selection;
clipboard->display = display;
clipboards = g_slist_prepend (clipboards, clipboard);
g_object_set_data (G_OBJECT (display), "gtk-clipboard-list", clipboards);
}
return clipboard;
}
/**
* gtk_clipboard_get():
* @selection: a #GdkAtom which identifies the clipboard
* to use.
*
* Returns the clipboard object for the given selection.
* See gtk_clipboard_get_for_display() for complete details.
*
* Return value: the appropriate clipboard object. If no
* clipboard already exists, a new one will
* be created. Once a clipboard object has
* been created, it is persistent for all time and
* cannot be freed.
**/
GtkClipboard *
gtk_clipboard_get (GdkAtom selection)
{
return gtk_clipboard_get_for_display (gdk_get_default_display (), selection);
}
static void
selection_get_cb (GtkWidget *widget,
GtkSelectionData *selection_data,
guint time,
guint info)
{
GtkClipboard *clipboard = gtk_clipboard_get (selection_data->selection);
GtkClipboard *clipboard = gtk_widget_get_clipboard (widget, selection_data->selection);
if (clipboard && clipboard->get_func)
clipboard->get_func (clipboard, selection_data, info, clipboard->user_data);
......@@ -165,7 +192,7 @@ static gboolean
selection_clear_event_cb (GtkWidget *widget,
GdkEventSelection *event)
{
GtkClipboard *clipboard = gtk_clipboard_get (event->selection);
GtkClipboard *clipboard = gtk_widget_get_clipboard (widget, event->selection);
if (clipboard)
{
......@@ -177,9 +204,10 @@ selection_clear_event_cb (GtkWidget *widget,
}
static GtkWidget *
make_clipboard_widget (gboolean provider)
make_clipboard_widget (GdkDisplay *display,
gboolean provider)
{
GtkWidget *widget = gtk_invisible_new ();
GtkWidget *widget = gtk_invisible_new_for_screen (gdk_display_get_default_screen (display));
gtk_signal_connect (GTK_OBJECT (widget), "selection_received",
GTK_SIGNAL_FUNC (selection_received), NULL);
......@@ -198,12 +226,17 @@ make_clipboard_widget (gboolean provider)
return widget;
}
static void
ensure_clipboard_widget ()
static GtkWidget *
get_clipboard_widget (GdkDisplay *display)
{
if (!clipboard_widget)
clipboard_widget = make_clipboard_widget (TRUE);
GtkWidget *clip_widget = g_object_get_data (G_OBJECT (display), "gtk-clipboard-widget");
if (!clip_widget)
{
clip_widget = make_clipboard_widget (display, TRUE);
g_object_set_data (G_OBJECT (display), "gtk-clipboard-widget", clip_widget);
}
return clip_widget;
}
/* This function makes a very good guess at what the correct
......@@ -224,10 +257,9 @@ ensure_clipboard_widget ()
static guint32
clipboard_get_timestamp (GtkClipboard *clipboard)
{
GtkWidget *clipboard_widget = get_clipboard_widget (clipboard->display);
guint32 timestamp = gtk_get_current_event_time ();
ensure_clipboard_widget ();
if (timestamp == GDK_CURRENT_TIME)
{
#ifdef GDK_WINDOWING_X11
......@@ -321,10 +353,12 @@ gtk_clipboard_set_contents (GtkClipboard *clipboard,
gpointer user_data,
gboolean have_owner)
{
ensure_clipboard_widget ();
GtkWidget *clipboard_widget = get_clipboard_widget (clipboard->display);
if (gtk_selection_owner_set (clipboard_widget, clipboard->selection,
clipboard_get_timestamp (clipboard)))
if (gtk_selection_owner_set_for_display (clipboard->display,
clipboard_widget,
clipboard->selection,
clipboard_get_timestamp (clipboard)))
{
clipboard->have_selection = TRUE;
......@@ -509,8 +543,10 @@ gtk_clipboard_clear (GtkClipboard *clipboard)
g_return_if_fail (clipboard != NULL);
if (clipboard->have_selection)
gtk_selection_owner_set (NULL, clipboard->selection,
clipboard_get_timestamp (clipboard));
gtk_selection_owner_set_for_display (clipboard->display,
NULL,
clipboard->selection,
clipboard_get_timestamp (clipboard));
}
static void
......@@ -595,13 +631,13 @@ selection_received (GtkWidget *widget,
RequestContentsInfo *request_info = get_request_contents_info (widget);
set_request_contents_info (widget, NULL);
request_info->callback (gtk_clipboard_get (selection_data->selection),
request_info->callback (gtk_widget_get_clipboard (widget, selection_data->selection),
selection_data,
request_info->user_data);
g_free (request_info);
if (widget != clipboard_widget)
if (widget != get_clipboard_widget (gtk_widget_get_display (widget)))
gtk_widget_destroy (widget);
}
......@@ -628,15 +664,16 @@ gtk_clipboard_request_contents (GtkClipboard *clipboard,
{
RequestContentsInfo *info;
GtkWidget *widget;
GtkWidget *clipboard_widget;
g_return_if_fail (clipboard != NULL);
g_return_if_fail (target != GDK_NONE);
g_return_if_fail (callback != NULL);
ensure_clipboard_widget ();
clipboard_widget = get_clipboard_widget (clipboard->display);
if (get_request_contents_info (clipboard_widget))
widget = make_clipboard_widget (FALSE);
widget = make_clipboard_widget (clipboard->display, FALSE);
else
widget = clipboard_widget;
......@@ -840,6 +877,21 @@ gtk_clipboard_wait_for_text (GtkClipboard *clipboard)
return results.data;
}
/**
* gtk_clipboard_get_display:
* @clipboard: a #GtkClipboard
*
* Gets the #GdkDisplay associated with @clipboard
*
* Return value: the #GdkDisplay associated with @clipboard
**/
GdkDisplay *
gtk_clipboard_get_display (GtkClipboard *clipboard)
{
g_return_val_if_fail (clipboard != NULL, NULL);
return clipboard->display;
}
/**
* gtk_clipboard_wait_is_text_available:
......
......@@ -28,7 +28,6 @@ extern "C" {
#include <gtk/gtkselection.h>
typedef struct _GtkClipboard GtkClipboard;
typedef void (* GtkClipboardReceivedFunc) (GtkClipboard *clipboard,
GtkSelectionData *selection_data,
......@@ -47,8 +46,15 @@ typedef void (* GtkClipboardGetFunc) (GtkClipboard *clipboard,
gpointer user_data_or_owner);
typedef void (* GtkClipboardClearFunc) (GtkClipboard *clipboard,
gpointer user_data_or_owner);
GtkClipboard *gtk_clipboard_get (GdkAtom selection);
GtkClipboard *gtk_clipboard_get_for_display (GdkDisplay *display,
GdkAtom selection);
#ifndef GDK_MULTIHEAD_SAFE
GtkClipboard *gtk_clipboard_get (GdkAtom selection);
#endif
GdkDisplay *gtk_clipboard_get_display (GtkClipboard *clipboard);
gboolean gtk_clipboard_set_with_data (GtkClipboard *clipboard,
const GtkTargetEntry *targets,
......
......@@ -1928,7 +1928,8 @@ abort_column_resize (GtkCList *clist)
GTK_CLIST_UNSET_FLAG (clist, CLIST_IN_DRAG);
gtk_grab_remove (GTK_WIDGET (clist));
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (clist)),
GDK_CURRENT_TIME);
clist->drag_pos = -1;
if (clist->x_drag >= 0 && clist->x_drag <= clist->clist_window_width - 1)
......@@ -3626,13 +3627,20 @@ fake_toggle_row (GtkCList *clist,
GTK_CLIST_ROW (work));
}
static gboolean
clist_has_grab (GtkCList *clist)
{
return (GTK_WIDGET_HAS_GRAB (clist) &&
gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (clist))));
}
static void
toggle_focus_row (GtkCList *clist)
{
g_return_if_fail (clist != 0);
g_return_if_fail (GTK_IS_CLIST (clist));
if ((gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist)) ||
if (clist_has_grab (clist) ||
clist->focus_row < 0 || clist->focus_row >= clist->rows)
return;
......@@ -3669,7 +3677,7 @@ toggle_add_mode (GtkCList *clist)
g_return_if_fail (clist != 0);
g_return_if_fail (GTK_IS_CLIST (clist));
if ((gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist)) ||
if (clist_has_grab (clist) ||
clist->selection_mode != GTK_SELECTION_MULTIPLE)
return;
......@@ -3791,7 +3799,7 @@ real_select_all (GtkCList *clist)
{
g_return_if_fail (GTK_IS_CLIST (clist));
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
if (clist_has_grab (clist))
return;
switch (clist->selection_mode)
......@@ -3831,7 +3839,7 @@ real_unselect_all (GtkCList *clist)
g_return_if_fail (GTK_IS_CLIST (clist));
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
if (clist_has_grab (clist))
return;
switch (clist->selection_mode)
......@@ -3916,7 +3924,7 @@ real_undo_selection (GtkCList *clist)
g_return_if_fail (GTK_IS_CLIST (clist));
if ((gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist)) ||
if (clist_has_grab (clist) ||
clist->selection_mode != GTK_SELECTION_MULTIPLE)
return;
......@@ -4268,7 +4276,7 @@ start_selection (GtkCList *clist)
{
g_return_if_fail (GTK_IS_CLIST (clist));
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
if (clist_has_grab (clist))
return;
set_anchor (clist, GTK_CLIST_ADD_MODE(clist), clist->focus_row,
......@@ -4280,7 +4288,8 @@ end_selection (GtkCList *clist)
{
g_return_if_fail (GTK_IS_CLIST (clist));
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_FOCUS(clist))
if (gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (clist))) &&
GTK_WIDGET_HAS_FOCUS (clist))
return;
GTK_CLIST_GET_CLASS (clist)->resync_selection (clist, NULL);
......@@ -4294,7 +4303,7 @@ extend_selection (GtkCList *clist,
{
g_return_if_fail (GTK_IS_CLIST (clist));
if ((gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist)) ||
if (clist_has_grab (clist) ||
clist->selection_mode != GTK_SELECTION_MULTIPLE)
return;
......@@ -4536,7 +4545,8 @@ gtk_clist_realize (GtkWidget *widget)
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
attributes_mask = GDK_WA_CURSOR;
attributes.cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
attributes.cursor = gdk_cursor_new_for_screen (gtk_widget_get_screen (widget),
GDK_SB_H_DOUBLE_ARROW);
clist->cursor_drag = attributes.cursor;
attributes.x = LIST_WIDTH (clist) + 1;
......@@ -4728,7 +4738,7 @@ gtk_clist_unmap (GtkWidget *widget)
{
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
if (clist_has_grab (clist))
{
remove_grab (clist);
......@@ -5116,7 +5126,7 @@ gtk_clist_button_release (GtkWidget *widget,
GTK_CLIST_UNSET_FLAG (clist, CLIST_IN_DRAG);
gtk_widget_get_pointer (widget, &x, NULL);
gtk_grab_remove (widget);
gdk_pointer_ungrab (event->time);
gdk_display_pointer_ungrab (gtk_widget_get_display (widget), event->time);
if (clist->x_drag >= 0)
draw_xor_line (clist);
......@@ -5191,7 +5201,7 @@ gtk_clist_motion (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
clist = GTK_CLIST (widget);
if (!(gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist)))
if (!clist_has_grab (clist))
return FALSE;
if (clist->drag_button > 0)
......@@ -6837,7 +6847,7 @@ scroll_horizontal (GtkCList *clist,
g_return_if_fail (clist != 0);
g_return_if_fail (GTK_IS_CLIST (clist));
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
if (clist_has_grab (clist))
return;
for (last_column = clist->columns - 1;
......@@ -6911,7 +6921,7 @@ scroll_vertical (GtkCList *clist,
g_return_if_fail (GTK_IS_CLIST (clist));
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
if (clist_has_grab (clist))
return;
switch (clist->selection_mode)
......@@ -7082,11 +7092,15 @@ vertical_timeout (GtkCList *clist)
static void
remove_grab (GtkCList *clist)
{
GtkWidget *widget = GTK_WIDGET (clist);
if (GTK_WIDGET_HAS_GRAB (clist))
{
gtk_grab_remove (GTK_WIDGET (clist));
if (gdk_pointer_is_grabbed ())
gdk_pointer_ungrab (GDK_CURRENT_TIME);
GdkDisplay *display = gtk_widget_get_display (widget);
gtk_grab_remove (widget);
if (gdk_display_pointer_is_grabbed (display))
gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
}
if (clist->htimer)
......@@ -7224,7 +7238,7 @@ real_sort_list (GtkCList *clist)
if (clist->rows <= 1)
return;
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
if (clist_has_grab (clist))
return;
gtk_clist_freeze (clist);
......@@ -7803,7 +7817,8 @@ gtk_clist_set_button_actions (GtkCList *clist,
if (button < MAX_BUTTON)
{
if (gdk_pointer_is_grabbed () || GTK_WIDGET_HAS_GRAB (clist))
if (gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (clist))) ||
GTK_WIDGET_HAS_GRAB (clist))
{
remove_grab (clist);
clist->drag_button = 0;
......
This diff is collapsed.
......@@ -49,6 +49,9 @@ typedef struct _GtkColorSelectionClass GtkColorSelectionClass;
typedef void (* GtkColorSelectionChangePaletteFunc) (const GdkColor *colors,
gint n_colors);
typedef void (* GtkColorSelectionChangePaletteWithScreenFunc) (GdkScreen *screen,
const GdkColor *colors,
gint n_colors);
struct _GtkColorSelection
{
......@@ -107,7 +110,11 @@ gboolean gtk_color_selection_palette_from_string (const gchar *str,
gchar* gtk_color_selection_palette_to_string (const GdkColor *colors,
gint n_colors);
GtkColorSelectionChangePaletteFunc gtk_color_selection_set_change_palette_hook (GtkColorSelectionChangePaletteFunc func);
#ifndef GDK_MULTIHEAD_SAFE
GtkColorSelectionChangePaletteFunc gtk_color_selection_set_change_palette_hook (GtkColorSelectionChangePaletteFunc func);
#endif
GtkColorSelectionChangePaletteWithScreenFunc gtk_color_selection_set_change_palette_with_screen_hook (GtkColorSelectionChangePaletteWithScreenFunc func);
#ifndef GTK_DISABLE_DEPRECATED
/* Deprecated calls: */
......
......@@ -62,6 +62,8 @@ enum {
static void gtk_combo_class_init (GtkComboClass *klass);
static void gtk_combo_init (GtkCombo *combo);
static void gtk_combo_realize (GtkWidget *widget);
static void gtk_combo_unrealize (GtkWidget *widget);
static void gtk_combo_destroy (GtkObject *combo);
static GtkListItem *gtk_combo_find (GtkCombo *combo);
static gchar * gtk_combo_func (GtkListItem *li);
......@@ -175,6 +177,8 @@ gtk_combo_class_init (GtkComboClass * klass)
oclass->destroy = gtk_combo_destroy;
widget_class->size_allocate = gtk_combo_size_allocate;
widget_class->realize = gtk_combo_realize;
widget_class->unrealize = gtk_combo_unrealize;
}
static void
......@@ -292,7 +296,8 @@ gtk_combo_window_key_press (GtkWidget *window,
if (GTK_WIDGET_HAS_GRAB (combo->popwin))
{
gtk_grab_remove (combo->popwin);
gdk_pointer_ungrab (event->time);
gdk_display_pointer_ungrab (gtk_widget_get_display (window),
event->time);
}
}
......@@ -423,7 +428,7 @@ gtk_combo_get_pos (GtkCombo * combo, gint * x, gint * y, gint * height, gint * w
real_height = MIN (combo->entry->requisition.height,
combo->entry->allocation.height);
*y += real_height;
avail_height = gdk_screen_height () - *y;
avail_height = gdk_screen_get_height (gtk_widget_get_screen (widget)) - *y;
gtk_widget_size_request (combo->list, &list_requisition);
min_height = MIN (list_requisition.height,
......@@ -520,7 +525,8 @@ gtk_combo_popdown_list (GtkCombo *combo)
if (GTK_WIDGET_HAS_GRAB (combo->popwin))
{
gtk_grab_remove (combo->popwin);
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (combo)),
GDK_CURRENT_TIME);
}
gtk_widget_hide (combo->popwin);
......@@ -741,13 +747,21 @@ gtk_combo_list_key_press (GtkWidget * widget, GdkEventKey * event, GtkCombo * co
return FALSE;
}
static void
combo_event_box_realize (GtkWidget *widget)
{
GdkCursor *cursor = gdk_cursor_new_for_screen (gtk_widget_get_screen (widget),
GDK_TOP_LEFT_ARROW);
gdk_window_set_cursor (widget->window, cursor);
gdk_cursor_destroy (cursor);
}
static void
gtk_combo_init (GtkCombo * combo)
{
GtkWidget *arrow;
GtkWidget *frame;
GtkWidget *event_box;
GdkCursor *cursor;
combo->case_sensitive = FALSE;
combo->value_in_list = FALSE;
......@@ -789,12 +803,10 @@ gtk_combo_init (GtkCombo * combo)
event_box = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (combo->popwin), event_box);
g_signal_connect (event_box, "realize",
G_CALLBACK (combo_event_box_realize), NULL);
gtk_widget_show (event_box);
gtk_widget_realize (event_box);
cursor = gdk_cursor_new (GDK_TOP_LEFT_ARROW);
gdk_window_set_cursor (event_box->window, cursor);
gdk_cursor_destroy (cursor);
frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (event_box), frame);
......@@ -840,6 +852,28 @@ gtk_combo_init (GtkCombo * combo)
GTK_SIGNAL_FUNC (gtk_combo_list_enter), combo);
}
static void
gtk_combo_realize (GtkWidget *widget)
{
GtkCombo *combo = GTK_COMBO (widget);
gtk_window_set_screen (GTK_WINDOW (combo->popwin),
gtk_widget_get_screen (widget));
GTK_WIDGET_CLASS( parent_class )->realize (widget);
}
static void
gtk_combo_unrealize (GtkWidget *widget)
{
GtkCombo *combo = GTK_COMBO (widget);
gtk_combo_popdown_list (combo);
gtk_widget_unrealize (combo->popwin);
GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
}
GtkType
gtk_combo_get_type (void)
{
......
......@@ -2480,7 +2480,8 @@ change_focus_row_expansion (GtkCTree *ctree,
clist = GTK_CLIST (ctree);
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (ctree))
if (gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (ctree))) &&
GTK_WIDGET_HAS_GRAB (ctree))
return;
if (!(node =
......@@ -4765,10 +4766,12 @@ gtk_ctree_node_set_shift (GtkCTree *ctree,
static void
remove_grab (GtkCList *clist)
{
if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist))
if (gdk_display_pointer_is_grabbed (gtk_widget_get_display (GTK_WIDGET (clist))) &&
GTK_WIDGET_HAS_GRAB (clist))
{
gtk_grab_remove (GTK_WIDGET (clist));
gdk_pointer_ungrab (GDK_CURRENT_TIME);
gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (clist)),
GDK_CURRENT_TIME);
}
if (clist->htimer)
......
......@@ -652,7 +652,8 @@ gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c)
c->cursor_type = new_type;
cursor = gdk_cursor_new (c->cursor_type);
cursor = gdk_cursor_new_for_screen (gtk_widget_get_screen (w),
c->cursor_type);
gdk_window_set_cursor (w->window, cursor);
gdk_cursor_destroy (cursor);
}
......@@ -722,14 +723,15 @@ gtk_curve_size_graph (GtkCurve *curve)
{
gint width, height;
gfloat aspect;
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (curve));
width = (curve->max_x - curve->min_x) + 1;
height = (curve->max_y - curve->min_y) + 1;
aspect = width / (gfloat) height;
if (width > gdk_screen_width () / 4)
width = gdk_screen_width () / 4;
if (height > gdk_screen_height () / 4)
height = gdk_screen_height () / 4;
if (width > gdk_screen_get_width (screen) / 4)
width = gdk_screen_get_width (screen) / 4;
if (height > gdk_screen_get_height (screen) / 4)
height = gdk_screen_get_height (screen) / 4;
if (aspect < 1.0)
width = height * aspect;
......@@ -857,6 +859,7 @@ gtk_curve_set_vector (GtkCurve *c, int veclen, gfloat vector[])
GtkCurveType old_type;
gfloat rx, dx, ry;
gint i, height;
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (c));
old_type = c->curve_type;
c->curve_type = GTK_CURVE_TYPE_FREE;
......@@ -866,8 +869,8 @@ gtk_curve_set_vector (GtkCurve *c, int veclen, gfloat vector[])
else
{
height =