1997-11-24 22:37:52 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-04-13 02:02:47 +00:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
1997-11-24 22:37:52 +00:00
|
|
|
*/
|
1999-02-24 07:37:18 +00:00
|
|
|
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
#include "gtkgc.h"
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GtkGCKey GtkGCKey;
|
|
|
|
typedef struct _GtkGCDrawable GtkGCDrawable;
|
|
|
|
|
|
|
|
struct _GtkGCKey
|
|
|
|
{
|
|
|
|
gint depth;
|
|
|
|
GdkColormap *colormap;
|
|
|
|
GdkGCValues values;
|
|
|
|
GdkGCValuesMask mask;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _GtkGCDrawable
|
|
|
|
{
|
|
|
|
gint depth;
|
|
|
|
GdkPixmap *drawable;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void gtk_gc_init (void);
|
|
|
|
static GtkGCKey* gtk_gc_key_dup (GtkGCKey *key);
|
|
|
|
static void gtk_gc_key_destroy (GtkGCKey *key);
|
|
|
|
static gpointer gtk_gc_new (gpointer key);
|
|
|
|
static void gtk_gc_destroy (gpointer value);
|
|
|
|
static guint gtk_gc_key_hash (gpointer key);
|
|
|
|
static guint gtk_gc_value_hash (gpointer value);
|
2000-11-13 13:15:41 +00:00
|
|
|
static gint gtk_gc_key_equal (gpointer a,
|
1997-11-24 22:37:52 +00:00
|
|
|
gpointer b);
|
|
|
|
static guint gtk_gc_drawable_hash (GtkGCDrawable *d);
|
2000-11-13 13:15:41 +00:00
|
|
|
static gint gtk_gc_drawable_equal (GtkGCDrawable *a,
|
1997-11-24 22:37:52 +00:00
|
|
|
GtkGCDrawable *b);
|
|
|
|
|
|
|
|
|
|
|
|
static gint initialize = TRUE;
|
|
|
|
static GCache *gc_cache = NULL;
|
|
|
|
|
|
|
|
static GMemChunk *key_mem_chunk = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
GdkGC*
|
|
|
|
gtk_gc_get (gint depth,
|
|
|
|
GdkColormap *colormap,
|
|
|
|
GdkGCValues *values,
|
|
|
|
GdkGCValuesMask values_mask)
|
|
|
|
{
|
|
|
|
GtkGCKey key;
|
|
|
|
GdkGC *gc;
|
|
|
|
|
|
|
|
if (initialize)
|
|
|
|
gtk_gc_init ();
|
|
|
|
|
|
|
|
key.depth = depth;
|
|
|
|
key.colormap = colormap;
|
|
|
|
key.values = *values;
|
|
|
|
key.mask = values_mask;
|
|
|
|
|
|
|
|
gc = g_cache_insert (gc_cache, &key);
|
|
|
|
|
|
|
|
return gc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_gc_release (GdkGC *gc)
|
|
|
|
{
|
|
|
|
if (initialize)
|
|
|
|
gtk_gc_init ();
|
|
|
|
|
|
|
|
g_cache_remove (gc_cache, gc);
|
|
|
|
}
|
|
|
|
|
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.
2002-04-29 22:53:45 +00:00
|
|
|
static void
|
|
|
|
free_gc_drawable (gpointer data)
|
|
|
|
{
|
|
|
|
GtkGCDrawable *drawable = data;
|
|
|
|
g_object_unref (G_OBJECT (drawable->drawable));
|
|
|
|
g_free (drawable);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GHashTable*
|
|
|
|
gtk_gc_get_drawable_ht (GdkScreen *screen)
|
|
|
|
{
|
|
|
|
GHashTable *ht = g_object_get_data (G_OBJECT (screen), "gtk-gc-drawable-ht");
|
|
|
|
if (!ht)
|
|
|
|
{
|
|
|
|
ht = g_hash_table_new_full ((GHashFunc) gtk_gc_drawable_hash,
|
|
|
|
(GEqualFunc) gtk_gc_drawable_equal,
|
|
|
|
NULL, free_gc_drawable);
|
|
|
|
g_object_set_data_full (G_OBJECT (screen),
|
|
|
|
"gtk-gc-drawable-ht", ht,
|
|
|
|
(GDestroyNotify)g_hash_table_destroy);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ht;
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
static void
|
1998-05-03 22:41:32 +00:00
|
|
|
gtk_gc_init (void)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
initialize = FALSE;
|
|
|
|
|
|
|
|
gc_cache = g_cache_new ((GCacheNewFunc) gtk_gc_new,
|
|
|
|
(GCacheDestroyFunc) gtk_gc_destroy,
|
|
|
|
(GCacheDupFunc) gtk_gc_key_dup,
|
|
|
|
(GCacheDestroyFunc) gtk_gc_key_destroy,
|
|
|
|
(GHashFunc) gtk_gc_key_hash,
|
|
|
|
(GHashFunc) gtk_gc_value_hash,
|
2000-11-13 13:15:41 +00:00
|
|
|
(GEqualFunc) gtk_gc_key_equal);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GtkGCKey*
|
|
|
|
gtk_gc_key_dup (GtkGCKey *key)
|
|
|
|
{
|
|
|
|
GtkGCKey *new_key;
|
|
|
|
|
|
|
|
if (!key_mem_chunk)
|
|
|
|
key_mem_chunk = g_mem_chunk_new ("key mem chunk", sizeof (GtkGCKey),
|
|
|
|
1024, G_ALLOC_AND_FREE);
|
|
|
|
|
|
|
|
new_key = g_chunk_new (GtkGCKey, key_mem_chunk);
|
|
|
|
|
|
|
|
*new_key = *key;
|
|
|
|
|
|
|
|
return new_key;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_gc_key_destroy (GtkGCKey *key)
|
|
|
|
{
|
|
|
|
g_mem_chunk_free (key_mem_chunk, key);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gtk_gc_new (gpointer key)
|
|
|
|
{
|
|
|
|
GtkGCKey *keyval;
|
|
|
|
GtkGCDrawable *drawable;
|
|
|
|
GdkGC *gc;
|
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.
2002-04-29 22:53:45 +00:00
|
|
|
GHashTable *ht;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
keyval = key;
|
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.
2002-04-29 22:53:45 +00:00
|
|
|
ht = gtk_gc_get_drawable_ht (keyval->colormap->screen);
|
|
|
|
drawable = g_hash_table_lookup (ht, &keyval->depth);
|
1997-11-24 22:37:52 +00:00
|
|
|
if (!drawable)
|
|
|
|
{
|
|
|
|
drawable = g_new (GtkGCDrawable, 1);
|
|
|
|
drawable->depth = keyval->depth;
|
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.
2002-04-29 22:53:45 +00:00
|
|
|
drawable->drawable = gdk_pixmap_new (gdk_screen_get_root_window (keyval->colormap->screen),
|
|
|
|
1, 1, drawable->depth);
|
|
|
|
g_hash_table_insert (ht, &drawable->depth, drawable);
|
1997-11-24 22:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gc = gdk_gc_new_with_values (drawable->drawable, &keyval->values, keyval->mask);
|
Add gdk_rgb_find_color() to get a pixel value using GdkRGB functionality
Sun Jul 2 12:45:50 2000 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.[ch]: Add gdk_rgb_find_color() to get a pixel
value using GdkRGB functionality given GdkColormap and GdkColor.
(name not final, waiting for inspiration.)
* gdk/gdkgc.[ch] (gdk_gc_set_rgb_fg/bg_color): New functions to
set the foreground/background of a GC using the GC's colormap
and GdkRGB. (name not final, waiting for inspiration.)
* gdk/gdkcompat.h gdk/gdkrgb.c (gdk_rgb_get_colormap): Rename from
gdk_rgb_get_cmap(), put #define in gdkcompat.h.
* gtk/gtkwidget.[ch] gtkcompat.h: Make visuals for
gtk_widget_get_visual(), gtk_widget_get_default_visual, etc,
purely a function of the corresponding colormap. Make
gtk_widget_set_visual(), etc, noop macros in gtkcompat.h.
* gdk/gdkpixmap.c gdk/x11/gdkpixmap-c11.c: Rewrite
gdk_pixbuf_*create_from_xpm_* in terms of
gdk_pixbuf_new_from_xpm_data(), move into platform independent
code.
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable): Take
advantage of the new draw_rgb_32_image_dithalign.
* gdk/gdkrgb.c (gdk_draw_rgb_32_image_dithalign): Added.
* gtk/gtkgc.c (gtk_gc_new): Set the appropriate colormap
on each created GC.
* gdk/gdkgc.[ch]: Add gdk_gc_get/set_colormap.
* gdk/gdkgc.[ch]: Add a colormap field to the GdkGC structure
which we initialize from the drawable when the GC is created,
if the drawable has a colormap.
* gdk/x11/gdkgc-x11.c: include string.h for memset.
* gdk/x11/gdkinput-x11.c: include string.h for strlen, etc.
* gtk/gtklayout.[ch]: Remove unsed configure serial member.
2000-07-02 17:03:21 +00:00
|
|
|
gdk_gc_set_colormap (gc, keyval->colormap);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
|
|
return (gpointer) gc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_gc_destroy (gpointer value)
|
|
|
|
{
|
|
|
|
gdk_gc_destroy ((GdkGC*) value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint
|
|
|
|
gtk_gc_key_hash (gpointer key)
|
|
|
|
{
|
|
|
|
GtkGCKey *keyval;
|
|
|
|
guint hash_val;
|
|
|
|
|
|
|
|
keyval = key;
|
|
|
|
hash_val = 0;
|
|
|
|
|
|
|
|
if (keyval->mask & GDK_GC_FOREGROUND)
|
|
|
|
{
|
|
|
|
hash_val += keyval->values.foreground.pixel;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_BACKGROUND)
|
|
|
|
{
|
|
|
|
hash_val += keyval->values.background.pixel;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_FONT)
|
|
|
|
{
|
|
|
|
hash_val += gdk_font_id (keyval->values.font);
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_FUNCTION)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.function;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_FILL)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.fill;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_TILE)
|
|
|
|
{
|
|
|
|
hash_val += (glong) keyval->values.tile;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_STIPPLE)
|
|
|
|
{
|
|
|
|
hash_val += (glong) keyval->values.stipple;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_CLIP_MASK)
|
|
|
|
{
|
|
|
|
hash_val += (glong) keyval->values.clip_mask;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_SUBWINDOW)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.subwindow_mode;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_TS_X_ORIGIN)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.ts_x_origin;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_TS_Y_ORIGIN)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.ts_y_origin;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_CLIP_X_ORIGIN)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.clip_x_origin;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_CLIP_Y_ORIGIN)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.clip_y_origin;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_EXPOSURES)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.graphics_exposures;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_LINE_WIDTH)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.line_width;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_LINE_STYLE)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.line_style;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_CAP_STYLE)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.cap_style;
|
|
|
|
}
|
|
|
|
if (keyval->mask & GDK_GC_JOIN_STYLE)
|
|
|
|
{
|
|
|
|
hash_val += (gint) keyval->values.join_style;
|
|
|
|
}
|
|
|
|
|
|
|
|
return hash_val;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint
|
|
|
|
gtk_gc_value_hash (gpointer value)
|
|
|
|
{
|
|
|
|
return (gulong) value;
|
|
|
|
}
|
|
|
|
|
2000-11-13 13:15:41 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_gc_key_equal (gpointer a,
|
|
|
|
gpointer b)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
GtkGCKey *akey;
|
|
|
|
GtkGCKey *bkey;
|
|
|
|
GdkGCValues *avalues;
|
|
|
|
GdkGCValues *bvalues;
|
|
|
|
|
|
|
|
akey = a;
|
|
|
|
bkey = b;
|
|
|
|
|
|
|
|
avalues = &akey->values;
|
|
|
|
bvalues = &bkey->values;
|
|
|
|
|
|
|
|
if (akey->mask != bkey->mask)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (akey->depth != bkey->depth)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (akey->colormap != bkey->colormap)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (akey->mask & GDK_GC_FOREGROUND)
|
|
|
|
{
|
|
|
|
if (avalues->foreground.pixel != bvalues->foreground.pixel)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_BACKGROUND)
|
|
|
|
{
|
|
|
|
if (avalues->background.pixel != bvalues->background.pixel)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_FONT)
|
|
|
|
{
|
|
|
|
if (!gdk_font_equal (avalues->font, bvalues->font))
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_FUNCTION)
|
|
|
|
{
|
|
|
|
if (avalues->function != bvalues->function)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_FILL)
|
|
|
|
{
|
|
|
|
if (avalues->fill != bvalues->fill)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_TILE)
|
|
|
|
{
|
|
|
|
if (avalues->tile != bvalues->tile)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_STIPPLE)
|
|
|
|
{
|
|
|
|
if (avalues->stipple != bvalues->stipple)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_CLIP_MASK)
|
|
|
|
{
|
|
|
|
if (avalues->clip_mask != bvalues->clip_mask)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_SUBWINDOW)
|
|
|
|
{
|
|
|
|
if (avalues->subwindow_mode != bvalues->subwindow_mode)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_TS_X_ORIGIN)
|
|
|
|
{
|
|
|
|
if (avalues->ts_x_origin != bvalues->ts_x_origin)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_TS_Y_ORIGIN)
|
|
|
|
{
|
|
|
|
if (avalues->ts_y_origin != bvalues->ts_y_origin)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_CLIP_X_ORIGIN)
|
|
|
|
{
|
|
|
|
if (avalues->clip_x_origin != bvalues->clip_x_origin)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_CLIP_Y_ORIGIN)
|
|
|
|
{
|
|
|
|
if (avalues->clip_y_origin != bvalues->clip_y_origin)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_EXPOSURES)
|
|
|
|
{
|
|
|
|
if (avalues->graphics_exposures != bvalues->graphics_exposures)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_LINE_WIDTH)
|
|
|
|
{
|
|
|
|
if (avalues->line_width != bvalues->line_width)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_LINE_STYLE)
|
|
|
|
{
|
|
|
|
if (avalues->line_style != bvalues->line_style)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_CAP_STYLE)
|
|
|
|
{
|
|
|
|
if (avalues->cap_style != bvalues->cap_style)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (akey->mask & GDK_GC_JOIN_STYLE)
|
|
|
|
{
|
|
|
|
if (avalues->join_style != bvalues->join_style)
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static guint
|
|
|
|
gtk_gc_drawable_hash (GtkGCDrawable *d)
|
|
|
|
{
|
|
|
|
return d->depth;
|
|
|
|
}
|
|
|
|
|
2000-11-13 13:15:41 +00:00
|
|
|
static gboolean
|
|
|
|
gtk_gc_drawable_equal (GtkGCDrawable *a,
|
|
|
|
GtkGCDrawable *b)
|
1997-11-24 22:37:52 +00:00
|
|
|
{
|
|
|
|
return (a->depth == b->depth);
|
|
|
|
}
|