mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
- Show selection correctly when starting selection with arrows
Sun Mar 8 15:53:33 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtktext.c: - Show selection correctly when starting selection with arrows - Display pixmap background only when not editable - Redraw focus area more carefully to prevent flashing (and make style of drawing consistent with Entry) * gtk/gtktreeitem.c: ref colormaps for pixmap by colormap storage. * gtk/gtkrc.c: Store a separate style for each RcStyle for each colormap, so we can handle background pixmaps correctly, which need to be per-colormap. (Leaks colormaps...) Parse text color style entries correctly. * gtk/testgtk.c: insert text without fg color gtk/testgtkrc: move "*" after rest, so the other class styles take effect * gdk/gdkwindow.c gdk/gdk.c gdk/gdkprivate.h: Send DND events safely, in case drop window disappears. (Performance hit because XSync()'s are necessary) * gdk/gdk.h gdk/gdkpixmap.c: Added gdk_pixmap_colormap_create_from_xpm[_d] to allow creating pixmaps from xpm's before you have a GdkWindow.
This commit is contained in:
parent
85f1364922
commit
ab30a02e5f
33
ChangeLog
33
ChangeLog
@ -1,3 +1,36 @@
|
||||
Sun Mar 8 15:53:33 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c:
|
||||
|
||||
- Show selection correctly when starting selection with arrows
|
||||
|
||||
- Display pixmap background only when not editable
|
||||
|
||||
- Redraw focus area more carefully to prevent flashing (and
|
||||
make style of drawing consistent with Entry)
|
||||
|
||||
* gtk/gtktreeitem.c: ref colormaps for pixmap by colormap
|
||||
storage.
|
||||
|
||||
* gtk/gtkrc.c: Store a separate style for each RcStyle for
|
||||
each colormap, so we can handle background pixmaps
|
||||
correctly, which need to be per-colormap. (Leaks
|
||||
colormaps...)
|
||||
|
||||
Parse text color style entries correctly.
|
||||
|
||||
* gtk/testgtk.c: insert text without fg color
|
||||
gtk/testgtkrc: move "*" after rest, so the other class styles
|
||||
take effect
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdk.c gdk/gdkprivate.h: Send DND events
|
||||
safely, in case drop window disappears. (Performance hit
|
||||
because XSync()'s are necessary)
|
||||
|
||||
* gdk/gdk.h gdk/gdkpixmap.c: Added
|
||||
gdk_pixmap_colormap_create_from_xpm[_d] to allow creating
|
||||
pixmaps from xpm's before you have a GdkWindow.
|
||||
|
||||
Sun Mar 8 12:33:38 PST 1998 Jay Painter <jpaint@serv.net>
|
||||
|
||||
* gtk/gtkclist.c: the GList clist->selection now contains row indexes
|
||||
|
@ -1,3 +1,36 @@
|
||||
Sun Mar 8 15:53:33 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c:
|
||||
|
||||
- Show selection correctly when starting selection with arrows
|
||||
|
||||
- Display pixmap background only when not editable
|
||||
|
||||
- Redraw focus area more carefully to prevent flashing (and
|
||||
make style of drawing consistent with Entry)
|
||||
|
||||
* gtk/gtktreeitem.c: ref colormaps for pixmap by colormap
|
||||
storage.
|
||||
|
||||
* gtk/gtkrc.c: Store a separate style for each RcStyle for
|
||||
each colormap, so we can handle background pixmaps
|
||||
correctly, which need to be per-colormap. (Leaks
|
||||
colormaps...)
|
||||
|
||||
Parse text color style entries correctly.
|
||||
|
||||
* gtk/testgtk.c: insert text without fg color
|
||||
gtk/testgtkrc: move "*" after rest, so the other class styles
|
||||
take effect
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdk.c gdk/gdkprivate.h: Send DND events
|
||||
safely, in case drop window disappears. (Performance hit
|
||||
because XSync()'s are necessary)
|
||||
|
||||
* gdk/gdk.h gdk/gdkpixmap.c: Added
|
||||
gdk_pixmap_colormap_create_from_xpm[_d] to allow creating
|
||||
pixmaps from xpm's before you have a GdkWindow.
|
||||
|
||||
Sun Mar 8 12:33:38 PST 1998 Jay Painter <jpaint@serv.net>
|
||||
|
||||
* gtk/gtkclist.c: the GList clist->selection now contains row indexes
|
||||
|
@ -1,3 +1,36 @@
|
||||
Sun Mar 8 15:53:33 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c:
|
||||
|
||||
- Show selection correctly when starting selection with arrows
|
||||
|
||||
- Display pixmap background only when not editable
|
||||
|
||||
- Redraw focus area more carefully to prevent flashing (and
|
||||
make style of drawing consistent with Entry)
|
||||
|
||||
* gtk/gtktreeitem.c: ref colormaps for pixmap by colormap
|
||||
storage.
|
||||
|
||||
* gtk/gtkrc.c: Store a separate style for each RcStyle for
|
||||
each colormap, so we can handle background pixmaps
|
||||
correctly, which need to be per-colormap. (Leaks
|
||||
colormaps...)
|
||||
|
||||
Parse text color style entries correctly.
|
||||
|
||||
* gtk/testgtk.c: insert text without fg color
|
||||
gtk/testgtkrc: move "*" after rest, so the other class styles
|
||||
take effect
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdk.c gdk/gdkprivate.h: Send DND events
|
||||
safely, in case drop window disappears. (Performance hit
|
||||
because XSync()'s are necessary)
|
||||
|
||||
* gdk/gdk.h gdk/gdkpixmap.c: Added
|
||||
gdk_pixmap_colormap_create_from_xpm[_d] to allow creating
|
||||
pixmaps from xpm's before you have a GdkWindow.
|
||||
|
||||
Sun Mar 8 12:33:38 PST 1998 Jay Painter <jpaint@serv.net>
|
||||
|
||||
* gtk/gtkclist.c: the GList clist->selection now contains row indexes
|
||||
|
@ -1,3 +1,36 @@
|
||||
Sun Mar 8 15:53:33 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c:
|
||||
|
||||
- Show selection correctly when starting selection with arrows
|
||||
|
||||
- Display pixmap background only when not editable
|
||||
|
||||
- Redraw focus area more carefully to prevent flashing (and
|
||||
make style of drawing consistent with Entry)
|
||||
|
||||
* gtk/gtktreeitem.c: ref colormaps for pixmap by colormap
|
||||
storage.
|
||||
|
||||
* gtk/gtkrc.c: Store a separate style for each RcStyle for
|
||||
each colormap, so we can handle background pixmaps
|
||||
correctly, which need to be per-colormap. (Leaks
|
||||
colormaps...)
|
||||
|
||||
Parse text color style entries correctly.
|
||||
|
||||
* gtk/testgtk.c: insert text without fg color
|
||||
gtk/testgtkrc: move "*" after rest, so the other class styles
|
||||
take effect
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdk.c gdk/gdkprivate.h: Send DND events
|
||||
safely, in case drop window disappears. (Performance hit
|
||||
because XSync()'s are necessary)
|
||||
|
||||
* gdk/gdk.h gdk/gdkpixmap.c: Added
|
||||
gdk_pixmap_colormap_create_from_xpm[_d] to allow creating
|
||||
pixmaps from xpm's before you have a GdkWindow.
|
||||
|
||||
Sun Mar 8 12:33:38 PST 1998 Jay Painter <jpaint@serv.net>
|
||||
|
||||
* gtk/gtkclist.c: the GList clist->selection now contains row indexes
|
||||
|
@ -1,3 +1,36 @@
|
||||
Sun Mar 8 15:53:33 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c:
|
||||
|
||||
- Show selection correctly when starting selection with arrows
|
||||
|
||||
- Display pixmap background only when not editable
|
||||
|
||||
- Redraw focus area more carefully to prevent flashing (and
|
||||
make style of drawing consistent with Entry)
|
||||
|
||||
* gtk/gtktreeitem.c: ref colormaps for pixmap by colormap
|
||||
storage.
|
||||
|
||||
* gtk/gtkrc.c: Store a separate style for each RcStyle for
|
||||
each colormap, so we can handle background pixmaps
|
||||
correctly, which need to be per-colormap. (Leaks
|
||||
colormaps...)
|
||||
|
||||
Parse text color style entries correctly.
|
||||
|
||||
* gtk/testgtk.c: insert text without fg color
|
||||
gtk/testgtkrc: move "*" after rest, so the other class styles
|
||||
take effect
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdk.c gdk/gdkprivate.h: Send DND events
|
||||
safely, in case drop window disappears. (Performance hit
|
||||
because XSync()'s are necessary)
|
||||
|
||||
* gdk/gdk.h gdk/gdkpixmap.c: Added
|
||||
gdk_pixmap_colormap_create_from_xpm[_d] to allow creating
|
||||
pixmaps from xpm's before you have a GdkWindow.
|
||||
|
||||
Sun Mar 8 12:33:38 PST 1998 Jay Painter <jpaint@serv.net>
|
||||
|
||||
* gtk/gtkclist.c: the GList clist->selection now contains row indexes
|
||||
|
@ -1,3 +1,36 @@
|
||||
Sun Mar 8 15:53:33 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c:
|
||||
|
||||
- Show selection correctly when starting selection with arrows
|
||||
|
||||
- Display pixmap background only when not editable
|
||||
|
||||
- Redraw focus area more carefully to prevent flashing (and
|
||||
make style of drawing consistent with Entry)
|
||||
|
||||
* gtk/gtktreeitem.c: ref colormaps for pixmap by colormap
|
||||
storage.
|
||||
|
||||
* gtk/gtkrc.c: Store a separate style for each RcStyle for
|
||||
each colormap, so we can handle background pixmaps
|
||||
correctly, which need to be per-colormap. (Leaks
|
||||
colormaps...)
|
||||
|
||||
Parse text color style entries correctly.
|
||||
|
||||
* gtk/testgtk.c: insert text without fg color
|
||||
gtk/testgtkrc: move "*" after rest, so the other class styles
|
||||
take effect
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdk.c gdk/gdkprivate.h: Send DND events
|
||||
safely, in case drop window disappears. (Performance hit
|
||||
because XSync()'s are necessary)
|
||||
|
||||
* gdk/gdk.h gdk/gdkpixmap.c: Added
|
||||
gdk_pixmap_colormap_create_from_xpm[_d] to allow creating
|
||||
pixmaps from xpm's before you have a GdkWindow.
|
||||
|
||||
Sun Mar 8 12:33:38 PST 1998 Jay Painter <jpaint@serv.net>
|
||||
|
||||
* gtk/gtkclist.c: the GList clist->selection now contains row indexes
|
||||
|
@ -1,3 +1,36 @@
|
||||
Sun Mar 8 15:53:33 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtktext.c:
|
||||
|
||||
- Show selection correctly when starting selection with arrows
|
||||
|
||||
- Display pixmap background only when not editable
|
||||
|
||||
- Redraw focus area more carefully to prevent flashing (and
|
||||
make style of drawing consistent with Entry)
|
||||
|
||||
* gtk/gtktreeitem.c: ref colormaps for pixmap by colormap
|
||||
storage.
|
||||
|
||||
* gtk/gtkrc.c: Store a separate style for each RcStyle for
|
||||
each colormap, so we can handle background pixmaps
|
||||
correctly, which need to be per-colormap. (Leaks
|
||||
colormaps...)
|
||||
|
||||
Parse text color style entries correctly.
|
||||
|
||||
* gtk/testgtk.c: insert text without fg color
|
||||
gtk/testgtkrc: move "*" after rest, so the other class styles
|
||||
take effect
|
||||
|
||||
* gdk/gdkwindow.c gdk/gdk.c gdk/gdkprivate.h: Send DND events
|
||||
safely, in case drop window disappears. (Performance hit
|
||||
because XSync()'s are necessary)
|
||||
|
||||
* gdk/gdk.h gdk/gdkpixmap.c: Added
|
||||
gdk_pixmap_colormap_create_from_xpm[_d] to allow creating
|
||||
pixmaps from xpm's before you have a GdkWindow.
|
||||
|
||||
Sun Mar 8 12:33:38 PST 1998 Jay Painter <jpaint@serv.net>
|
||||
|
||||
* gtk/gtkclist.c: the GList clist->selection now contains row indexes
|
||||
|
12
TODO
12
TODO
@ -88,6 +88,9 @@ Additions:
|
||||
* Change gtk_widget_propagate_default_style() mechanism to
|
||||
void gtk_rc_string_export (const gchar *rc_additions,
|
||||
gboolean override_rc_styles);
|
||||
|
||||
* Configure events for windows that no longer exist fail in
|
||||
XTranslateCoordinates
|
||||
|
||||
TODO AFTER GTK 1.0
|
||||
------------------
|
||||
@ -220,6 +223,11 @@ TODO AFTER GTK 1.0
|
||||
|
||||
- Disable pasting compound text
|
||||
|
||||
- When showing background pixmap (not editable) actually set
|
||||
the background pixmap as the windows bg pixmap, to improve
|
||||
appearance on exposes. But this would require using another
|
||||
window to get the origins.
|
||||
|
||||
? Allow moving the separator for paned widgets by dragging
|
||||
it directly instead of using the handle.
|
||||
|
||||
@ -243,3 +251,7 @@ TODO AFTER GTK 1.0
|
||||
gtk_widget_dnd_data_set (should be guchar * with a copy?
|
||||
shouldn't be there at all...)
|
||||
??? GtkDrawingarea.draw_data
|
||||
|
||||
* gtk_rc_add_[name/class]_style are broken for bg pixmaps, because
|
||||
styles are broken for bg pixmaps, and RC styles only hack around
|
||||
that.
|
34
gdk/gdk.c
34
gdk/gdk.c
@ -2714,8 +2714,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
replyev.xclient.data.l[2] = replyev.xclient.data.l[3] = 0;
|
||||
replyev.xclient.data.l[4] = reptype;
|
||||
|
||||
XSendEvent (gdk_display, replyev.xclient.window,
|
||||
False, NoEventMask, &replyev);
|
||||
if (!gdk_send_xevent (replyev.xclient.window, False,
|
||||
NoEventMask, &replyev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeRequest to %#lx failed\n",
|
||||
replyev.xclient.window));
|
||||
|
||||
event->any.type = GDK_DROP_ENTER;
|
||||
event->any.window = window;
|
||||
@ -3176,7 +3178,9 @@ gdk_dnd_drag_enter (Window dest)
|
||||
}
|
||||
else
|
||||
sev.xclient.data.l[3] = sev.xclient.data.l[4] = None;
|
||||
XSendEvent (gdk_display, dest, False, NoEventMask, &sev);
|
||||
if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeEnter to %#lx failed\n",
|
||||
dest));
|
||||
}
|
||||
|
||||
}
|
||||
@ -3731,7 +3735,9 @@ gdk_dnd_drag_leave (Window dest)
|
||||
{
|
||||
wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
|
||||
sev.xclient.data.l[0] = wp->xwindow;
|
||||
XSendEvent(gdk_display, dest, False, NoEventMask, &sev);
|
||||
if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeLeave to %#lx failed\n",
|
||||
dest));
|
||||
wp->dnd_drag_accepted = 0;
|
||||
}
|
||||
}
|
||||
@ -3990,7 +3996,9 @@ gdk_event_send_clientmessage_toall(GdkEvent *event)
|
||||
for(i = 0; i < ret_nchildren; i++) {
|
||||
curwin = gdk_get_client_window(gdk_display, ret_children[i]);
|
||||
sev.xclient.window = curwin;
|
||||
XSendEvent(gdk_display, curwin, False, NoEventMask, &sev);
|
||||
if (!gdk_send_xevent (curwin, False, NoEventMask, &sev))
|
||||
GDK_NOTE (MISC, g_print("Sending client message %ld to %#lx failed\n",
|
||||
event->client.message_type, curwin));
|
||||
}
|
||||
|
||||
XFree(ret_children);
|
||||
@ -4001,3 +4009,19 @@ gdk_get_display(void)
|
||||
{
|
||||
return (gchar *)XDisplayName (gdk_display_name);
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
|
||||
XEvent *event_send)
|
||||
{
|
||||
Status result;
|
||||
|
||||
gdk_error_code = 0;
|
||||
|
||||
gdk_error_warnings = 0;
|
||||
result = XSendEvent (gdk_display, window, propagate, event_mask, event_send);
|
||||
XSync (gdk_display, False);
|
||||
gdk_error_warnings = 1;
|
||||
|
||||
return result && (gdk_error_code != -1);
|
||||
}
|
||||
|
12
gdk/gdk.h
12
gdk/gdk.h
@ -382,10 +382,22 @@ GdkPixmap* gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename);
|
||||
GdkPixmap* gdk_pixmap_colormap_create_from_xpm
|
||||
(GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename);
|
||||
GdkPixmap* gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data);
|
||||
GdkPixmap* gdk_pixmap_colormap_create_from_xpm_d
|
||||
(GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data);
|
||||
GdkPixmap *gdk_pixmap_ref (GdkPixmap *pixmap);
|
||||
void gdk_pixmap_unref (GdkPixmap *pixmap);
|
||||
|
||||
|
@ -351,15 +351,15 @@ gdk_pixmap_extract_color (gchar *buffer)
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
{
|
||||
FILE *infile = NULL;
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkColormap *colormap;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc;
|
||||
GdkColor tmp_color;
|
||||
@ -369,7 +369,19 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
_GdkPixmapColor *colors = NULL, *color = NULL;
|
||||
gulong index;
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
infile = fopen (filename, "rb");
|
||||
if (infile != NULL)
|
||||
@ -386,9 +398,6 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
|
||||
colors = g_new(_GdkPixmapColor, num_cols);
|
||||
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
@ -514,14 +523,25 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
}
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data)
|
||||
gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
{
|
||||
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
|
||||
transparent_color, filename);
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data)
|
||||
{
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkColormap *colormap;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc;
|
||||
GdkColor tmp_color;
|
||||
@ -530,7 +550,19 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
_GdkPixmapColor *colors = NULL, *color = NULL;
|
||||
gulong index;
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
i = 0;
|
||||
buffer = data[i++];
|
||||
@ -538,9 +570,6 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
|
||||
colors = g_new(_GdkPixmapColor, num_cols);
|
||||
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
@ -657,6 +686,16 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data)
|
||||
{
|
||||
return gdk_pixmap_colormap_create_from_xpm_d (window, NULL, mask,
|
||||
transparent_color, data);
|
||||
}
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_ref (GdkPixmap *pixmap)
|
||||
{
|
||||
|
@ -223,6 +223,9 @@ void gdk_xid_table_insert (XID *xid,
|
||||
void gdk_xid_table_remove (XID xid);
|
||||
gpointer gdk_xid_table_lookup (XID xid);
|
||||
|
||||
gint gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
|
||||
XEvent *event_send);
|
||||
|
||||
/* If you pass x = y = -1, it queries the pointer
|
||||
to find out where it currently is.
|
||||
If you pass x = y = -2, it does anything necessary
|
||||
|
@ -1551,9 +1551,12 @@ gdk_window_dnd_data_set (GdkWindow *window,
|
||||
sev.xclient.data.l[3] = 0;
|
||||
|
||||
sev.xclient.data.l[4] = 0;
|
||||
|
||||
XSendEvent (gdk_display, event->dragrequest.requestor, False,
|
||||
NoEventMask, &sev);
|
||||
|
||||
if (!gdk_send_xevent (event->dragrequest.requestor, False,
|
||||
NoEventMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeDataAvailable to %#x failed\n",
|
||||
event->dragrequest.requestor));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2714,8 +2714,10 @@ gdk_event_translate (GdkEvent *event,
|
||||
replyev.xclient.data.l[2] = replyev.xclient.data.l[3] = 0;
|
||||
replyev.xclient.data.l[4] = reptype;
|
||||
|
||||
XSendEvent (gdk_display, replyev.xclient.window,
|
||||
False, NoEventMask, &replyev);
|
||||
if (!gdk_send_xevent (replyev.xclient.window, False,
|
||||
NoEventMask, &replyev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeRequest to %#lx failed\n",
|
||||
replyev.xclient.window));
|
||||
|
||||
event->any.type = GDK_DROP_ENTER;
|
||||
event->any.window = window;
|
||||
@ -3176,7 +3178,9 @@ gdk_dnd_drag_enter (Window dest)
|
||||
}
|
||||
else
|
||||
sev.xclient.data.l[3] = sev.xclient.data.l[4] = None;
|
||||
XSendEvent (gdk_display, dest, False, NoEventMask, &sev);
|
||||
if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeEnter to %#lx failed\n",
|
||||
dest));
|
||||
}
|
||||
|
||||
}
|
||||
@ -3731,7 +3735,9 @@ gdk_dnd_drag_leave (Window dest)
|
||||
{
|
||||
wp = (GdkWindowPrivate *) gdk_dnd.drag_startwindows[i];
|
||||
sev.xclient.data.l[0] = wp->xwindow;
|
||||
XSendEvent(gdk_display, dest, False, NoEventMask, &sev);
|
||||
if (!gdk_send_xevent (dest, False, NoEventMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeLeave to %#lx failed\n",
|
||||
dest));
|
||||
wp->dnd_drag_accepted = 0;
|
||||
}
|
||||
}
|
||||
@ -3990,7 +3996,9 @@ gdk_event_send_clientmessage_toall(GdkEvent *event)
|
||||
for(i = 0; i < ret_nchildren; i++) {
|
||||
curwin = gdk_get_client_window(gdk_display, ret_children[i]);
|
||||
sev.xclient.window = curwin;
|
||||
XSendEvent(gdk_display, curwin, False, NoEventMask, &sev);
|
||||
if (!gdk_send_xevent (curwin, False, NoEventMask, &sev))
|
||||
GDK_NOTE (MISC, g_print("Sending client message %ld to %#lx failed\n",
|
||||
event->client.message_type, curwin));
|
||||
}
|
||||
|
||||
XFree(ret_children);
|
||||
@ -4001,3 +4009,19 @@ gdk_get_display(void)
|
||||
{
|
||||
return (gchar *)XDisplayName (gdk_display_name);
|
||||
}
|
||||
|
||||
gint
|
||||
gdk_send_xevent (Window window, gboolean propagate, glong event_mask,
|
||||
XEvent *event_send)
|
||||
{
|
||||
Status result;
|
||||
|
||||
gdk_error_code = 0;
|
||||
|
||||
gdk_error_warnings = 0;
|
||||
result = XSendEvent (gdk_display, window, propagate, event_mask, event_send);
|
||||
XSync (gdk_display, False);
|
||||
gdk_error_warnings = 1;
|
||||
|
||||
return result && (gdk_error_code != -1);
|
||||
}
|
||||
|
@ -351,15 +351,15 @@ gdk_pixmap_extract_color (gchar *buffer)
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
gdk_pixmap_colormap_create_from_xpm (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
{
|
||||
FILE *infile = NULL;
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkColormap *colormap;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc;
|
||||
GdkColor tmp_color;
|
||||
@ -369,7 +369,19 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
_GdkPixmapColor *colors = NULL, *color = NULL;
|
||||
gulong index;
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
infile = fopen (filename, "rb");
|
||||
if (infile != NULL)
|
||||
@ -386,9 +398,6 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
|
||||
colors = g_new(_GdkPixmapColor, num_cols);
|
||||
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
@ -514,14 +523,25 @@ gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
}
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data)
|
||||
gdk_pixmap_create_from_xpm (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
const gchar *filename)
|
||||
{
|
||||
return gdk_pixmap_colormap_create_from_xpm (window, NULL, mask,
|
||||
transparent_color, filename);
|
||||
}
|
||||
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_colormap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkColormap *colormap,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data)
|
||||
{
|
||||
GdkPixmap *pixmap = NULL;
|
||||
GdkImage *image = NULL;
|
||||
GdkColormap *colormap;
|
||||
GdkVisual *visual;
|
||||
GdkGC *gc;
|
||||
GdkColor tmp_color;
|
||||
@ -530,7 +550,19 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
_GdkPixmapColor *colors = NULL, *color = NULL;
|
||||
gulong index;
|
||||
|
||||
g_return_val_if_fail (window != NULL, NULL);
|
||||
if ((window == NULL) && (colormap == NULL))
|
||||
g_warning ("Creating pixmap from xpm with NULL window and colormap");
|
||||
|
||||
if (window == NULL)
|
||||
window = (GdkWindow *)&gdk_root_parent;
|
||||
|
||||
if (colormap == NULL)
|
||||
{
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
}
|
||||
else
|
||||
visual = ((GdkColormapPrivate *)colormap)->visual;
|
||||
|
||||
i = 0;
|
||||
buffer = data[i++];
|
||||
@ -538,9 +570,6 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
|
||||
colors = g_new(_GdkPixmapColor, num_cols);
|
||||
|
||||
colormap = gdk_window_get_colormap (window);
|
||||
visual = gdk_window_get_visual (window);
|
||||
|
||||
if (transparent_color == NULL)
|
||||
{
|
||||
gdk_color_white (colormap, &tmp_color);
|
||||
@ -657,6 +686,16 @@ gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_create_from_xpm_d (GdkWindow *window,
|
||||
GdkBitmap **mask,
|
||||
GdkColor *transparent_color,
|
||||
gchar **data)
|
||||
{
|
||||
return gdk_pixmap_colormap_create_from_xpm_d (window, NULL, mask,
|
||||
transparent_color, data);
|
||||
}
|
||||
|
||||
GdkPixmap*
|
||||
gdk_pixmap_ref (GdkPixmap *pixmap)
|
||||
{
|
||||
|
@ -1551,9 +1551,12 @@ gdk_window_dnd_data_set (GdkWindow *window,
|
||||
sev.xclient.data.l[3] = 0;
|
||||
|
||||
sev.xclient.data.l[4] = 0;
|
||||
|
||||
XSendEvent (gdk_display, event->dragrequest.requestor, False,
|
||||
NoEventMask, &sev);
|
||||
|
||||
if (!gdk_send_xevent (event->dragrequest.requestor, False,
|
||||
NoEventMask, &sev))
|
||||
GDK_NOTE (DND, g_print("Sending XdeDataAvailable to %#x failed\n",
|
||||
event->dragrequest.requestor));
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
161
gtk/gtkrc.c
161
gtk/gtkrc.c
@ -60,15 +60,22 @@ enum {
|
||||
|
||||
typedef struct _GtkRcStyle GtkRcStyle;
|
||||
typedef struct _GtkRcSet GtkRcSet;
|
||||
typedef struct _GtkRcNode GtkRcNode;
|
||||
|
||||
struct _GtkRcNode
|
||||
{
|
||||
GdkColormap *cmap;
|
||||
GtkStyle *style;
|
||||
};
|
||||
|
||||
struct _GtkRcStyle
|
||||
{
|
||||
int initialize;
|
||||
char *name;
|
||||
char *font_name;
|
||||
char *fontset_name;
|
||||
char *bg_pixmap_name[5];
|
||||
GtkStyle *style;
|
||||
GtkStyle *proto_style;
|
||||
GList *styles;
|
||||
};
|
||||
|
||||
struct _GtkRcSet
|
||||
@ -86,7 +93,8 @@ static GtkRcStyle* gtk_rc_styles_match (GSList *sets,
|
||||
const char *path);
|
||||
static gint gtk_rc_style_match (const char *set,
|
||||
const char *path);
|
||||
static void gtk_rc_style_init (GtkRcStyle *rc_style);
|
||||
static GtkStyle* gtk_rc_style_init (GtkRcStyle *rc_style,
|
||||
GdkColormap *cmap);
|
||||
static void gtk_rc_parse_any (const gchar *input_name,
|
||||
gint input_fd,
|
||||
const gchar *input_string);
|
||||
@ -100,6 +108,8 @@ static gint gtk_rc_parse_bg (GScanner *scanner,
|
||||
GtkStyle *style);
|
||||
static gint gtk_rc_parse_fg (GScanner *scanner,
|
||||
GtkStyle *style);
|
||||
static gint gtk_rc_parse_text (GScanner *scanner,
|
||||
GtkStyle *style);
|
||||
static gint gtk_rc_parse_bg_pixmap (GScanner *scanner,
|
||||
GtkRcStyle *rc_style);
|
||||
static gint gtk_rc_parse_font (GScanner *scanner,
|
||||
@ -244,8 +254,8 @@ gtk_rc_get_style (GtkWidget *widget)
|
||||
|
||||
if (rc_style)
|
||||
{
|
||||
gtk_rc_style_init (rc_style);
|
||||
return rc_style->style;
|
||||
return gtk_rc_style_init (rc_style,
|
||||
gtk_widget_get_colormap (widget));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -260,8 +270,8 @@ gtk_rc_get_style (GtkWidget *widget)
|
||||
|
||||
if (rc_style)
|
||||
{
|
||||
gtk_rc_style_init (rc_style);
|
||||
return rc_style->style;
|
||||
return gtk_rc_style_init (rc_style,
|
||||
gtk_widget_get_colormap (widget));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -280,7 +290,6 @@ gtk_rc_add_widget_name_style (GtkStyle *style,
|
||||
gtk_style_ref (style);
|
||||
|
||||
rc_style = g_new (GtkRcStyle, 1);
|
||||
rc_style->initialize = FALSE;
|
||||
rc_style->name = NULL;
|
||||
rc_style->font_name = NULL;
|
||||
rc_style->fontset_name = NULL;
|
||||
@ -288,7 +297,7 @@ gtk_rc_add_widget_name_style (GtkStyle *style,
|
||||
for (i = 0; i < 5; i++)
|
||||
rc_style->bg_pixmap_name[i] = NULL;
|
||||
|
||||
rc_style->style = style;
|
||||
rc_style->styles = g_list_append (NULL, style);
|
||||
|
||||
rc_set = g_new (GtkRcSet, 1);
|
||||
rc_set->set = g_strdup (pattern);
|
||||
@ -308,7 +317,6 @@ gtk_rc_add_widget_class_style (GtkStyle *style,
|
||||
gtk_style_ref (style);
|
||||
|
||||
rc_style = g_new (GtkRcStyle, 1);
|
||||
rc_style->initialize = FALSE;
|
||||
rc_style->name = NULL;
|
||||
rc_style->font_name = NULL;
|
||||
rc_style->fontset_name = NULL;
|
||||
@ -316,7 +324,7 @@ gtk_rc_add_widget_class_style (GtkStyle *style,
|
||||
for (i = 0; i < 5; i++)
|
||||
rc_style->bg_pixmap_name[i] = NULL;
|
||||
|
||||
rc_style->style = style;
|
||||
rc_style->styles = g_list_append (NULL, style);
|
||||
|
||||
rc_set = g_new (GtkRcSet, 1);
|
||||
rc_set->set = g_strdup (pattern);
|
||||
@ -471,46 +479,72 @@ gtk_rc_style_match (const char *set,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_rc_style_init (GtkRcStyle *rc_style)
|
||||
static GtkStyle *
|
||||
gtk_rc_style_init (GtkRcStyle *rc_style, GdkColormap *cmap)
|
||||
{
|
||||
GdkFont *old_font;
|
||||
gint i;
|
||||
|
||||
if (rc_style->initialize)
|
||||
|
||||
GList *tmp_list;
|
||||
GtkStyle *style = NULL;
|
||||
|
||||
tmp_list = rc_style->styles;
|
||||
|
||||
while (tmp_list)
|
||||
{
|
||||
rc_style->initialize = FALSE;
|
||||
GtkRcNode *node = (GtkRcNode *)tmp_list->data;
|
||||
|
||||
if (node->cmap == cmap)
|
||||
style = node->style;
|
||||
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
if (!style)
|
||||
{
|
||||
style = gtk_style_copy (rc_style->proto_style);
|
||||
|
||||
if (rc_style->fontset_name)
|
||||
{
|
||||
old_font = rc_style->style->font;
|
||||
rc_style->style->font = gdk_fontset_load (rc_style->fontset_name);
|
||||
if (rc_style->style->font)
|
||||
old_font = style->font;
|
||||
style->font = gdk_fontset_load (rc_style->fontset_name);
|
||||
if (style->font)
|
||||
gdk_font_unref (old_font);
|
||||
else
|
||||
rc_style->style->font = old_font;
|
||||
style->font = old_font;
|
||||
}
|
||||
else if (rc_style->font_name)
|
||||
{
|
||||
old_font = rc_style->style->font;
|
||||
rc_style->style->font = gdk_font_load (rc_style->font_name);
|
||||
if (rc_style->style->font)
|
||||
old_font = style->font;
|
||||
style->font = gdk_font_load (rc_style->font_name);
|
||||
if (style->font)
|
||||
gdk_font_unref (old_font);
|
||||
else
|
||||
rc_style->style->font = old_font;
|
||||
style->font = old_font;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
if (rc_style->bg_pixmap_name[i])
|
||||
{
|
||||
if (strcmp (rc_style->bg_pixmap_name[i], "<parent>") == 0)
|
||||
rc_style->style->bg_pixmap[i] = (GdkPixmap*) GDK_PARENT_RELATIVE;
|
||||
style->bg_pixmap[i] = (GdkPixmap*) GDK_PARENT_RELATIVE;
|
||||
else
|
||||
rc_style->style->bg_pixmap[i] = gdk_pixmap_create_from_xpm (NULL, NULL,
|
||||
&rc_style->style->bg[i],
|
||||
rc_style->bg_pixmap_name[i]);
|
||||
style->bg_pixmap[i] =
|
||||
gdk_pixmap_colormap_create_from_xpm (NULL, cmap,
|
||||
NULL,
|
||||
&style->bg[i],
|
||||
rc_style->bg_pixmap_name[i]);
|
||||
}
|
||||
|
||||
rc_style->styles = g_list_append (rc_style->styles, style);
|
||||
|
||||
/* FIXME, this leaks colormaps, but if we don't do this, then we'll
|
||||
* be screwed, because we identify colormaps by address equality
|
||||
*/
|
||||
gdk_colormap_ref (cmap);
|
||||
}
|
||||
|
||||
return style;
|
||||
}
|
||||
|
||||
static gint
|
||||
@ -571,16 +605,15 @@ gtk_rc_parse_style (GScanner *scanner)
|
||||
{
|
||||
insert = TRUE;
|
||||
rc_style = g_new (GtkRcStyle, 1);
|
||||
rc_style->initialize = TRUE;
|
||||
rc_style->name = g_strdup (scanner->value.v_string);
|
||||
rc_style->font_name = NULL;
|
||||
rc_style->fontset_name = NULL;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
rc_style->bg_pixmap_name[i] = NULL;
|
||||
|
||||
rc_style->style = gtk_style_new ();
|
||||
gtk_style_ref (rc_style->style);
|
||||
|
||||
rc_style->proto_style = gtk_style_new();
|
||||
rc_style->styles = NULL;
|
||||
}
|
||||
|
||||
token = g_scanner_peek_next_token (scanner);
|
||||
@ -593,7 +626,7 @@ gtk_rc_parse_style (GScanner *scanner)
|
||||
{
|
||||
if (insert)
|
||||
{
|
||||
gtk_style_unref (rc_style->style);
|
||||
gtk_style_unref (rc_style->proto_style);
|
||||
g_free (rc_style);
|
||||
}
|
||||
return PARSE_ERROR;
|
||||
@ -604,17 +637,17 @@ gtk_rc_parse_style (GScanner *scanner)
|
||||
{
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
rc_style->style->fg[i] = parent_style->style->fg[i];
|
||||
rc_style->style->bg[i] = parent_style->style->bg[i];
|
||||
rc_style->style->light[i] = parent_style->style->light[i];
|
||||
rc_style->style->dark[i] = parent_style->style->dark[i];
|
||||
rc_style->style->mid[i] = parent_style->style->mid[i];
|
||||
rc_style->style->text[i] = parent_style->style->text[i];
|
||||
rc_style->style->base[i] = parent_style->style->base[i];
|
||||
rc_style->proto_style->fg[i] = parent_style->proto_style->fg[i];
|
||||
rc_style->proto_style->bg[i] = parent_style->proto_style->bg[i];
|
||||
rc_style->proto_style->light[i] = parent_style->proto_style->light[i];
|
||||
rc_style->proto_style->dark[i] = parent_style->proto_style->dark[i];
|
||||
rc_style->proto_style->mid[i] = parent_style->proto_style->mid[i];
|
||||
rc_style->proto_style->text[i] = parent_style->proto_style->text[i];
|
||||
rc_style->proto_style->base[i] = parent_style->proto_style->base[i];
|
||||
}
|
||||
|
||||
rc_style->style->black = parent_style->style->black;
|
||||
rc_style->style->white = parent_style->style->white;
|
||||
rc_style->proto_style->black = parent_style->proto_style->black;
|
||||
rc_style->proto_style->white = parent_style->proto_style->white;
|
||||
|
||||
if (rc_style->fontset_name)
|
||||
{
|
||||
@ -641,7 +674,7 @@ gtk_rc_parse_style (GScanner *scanner)
|
||||
{
|
||||
if (insert)
|
||||
{
|
||||
gtk_style_unref (rc_style->style);
|
||||
gtk_style_unref (rc_style->proto_style);
|
||||
g_free (rc_style);
|
||||
}
|
||||
return PARSE_ERROR;
|
||||
@ -656,7 +689,7 @@ gtk_rc_parse_style (GScanner *scanner)
|
||||
{
|
||||
if (insert)
|
||||
{
|
||||
gtk_style_unref (rc_style->style);
|
||||
gtk_style_unref (rc_style->proto_style);
|
||||
g_free (rc_style);
|
||||
}
|
||||
return error;
|
||||
@ -677,7 +710,7 @@ gtk_rc_parse_style (GScanner *scanner)
|
||||
if (rc_style->bg_pixmap_name[i])
|
||||
g_free (rc_style->bg_pixmap_name[i]);
|
||||
|
||||
gtk_style_unref (rc_style->style);
|
||||
gtk_style_unref (rc_style->proto_style);
|
||||
g_free (rc_style);
|
||||
}
|
||||
return PARSE_ERROR;
|
||||
@ -700,15 +733,19 @@ gtk_rc_parse_style_option (GScanner *scanner,
|
||||
if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
|
||||
return PARSE_ERROR;
|
||||
|
||||
error = gtk_rc_parse_base (scanner, rc_style->style);
|
||||
error = gtk_rc_parse_base (scanner, rc_style->proto_style);
|
||||
if (error != PARSE_SYNTAX)
|
||||
return error;
|
||||
|
||||
error = gtk_rc_parse_bg (scanner, rc_style->style);
|
||||
error = gtk_rc_parse_bg (scanner, rc_style->proto_style);
|
||||
if (error != PARSE_SYNTAX)
|
||||
return error;
|
||||
|
||||
error = gtk_rc_parse_fg (scanner, rc_style->style);
|
||||
error = gtk_rc_parse_fg (scanner, rc_style->proto_style);
|
||||
if (error != PARSE_SYNTAX)
|
||||
return error;
|
||||
|
||||
error = gtk_rc_parse_text (scanner, rc_style->proto_style);
|
||||
if (error != PARSE_SYNTAX)
|
||||
return error;
|
||||
|
||||
@ -809,6 +846,34 @@ gtk_rc_parse_fg (GScanner *scanner,
|
||||
return error;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_rc_parse_text (GScanner *scanner,
|
||||
GtkStyle *style)
|
||||
{
|
||||
GtkStateType state;
|
||||
gint token;
|
||||
gint error;
|
||||
|
||||
token = g_scanner_peek_next_token (scanner);
|
||||
if (token == G_TOKEN_EOF || token == G_TOKEN_ERROR)
|
||||
return PARSE_ERROR;
|
||||
if (token != TOKEN_TEXT)
|
||||
return PARSE_SYNTAX;
|
||||
token = g_scanner_get_next_token (scanner);
|
||||
|
||||
error = gtk_rc_parse_state (scanner, &state);
|
||||
if (error != PARSE_OK)
|
||||
return error;
|
||||
|
||||
token = g_scanner_get_next_token (scanner);
|
||||
if (token != G_TOKEN_EQUAL_SIGN)
|
||||
return PARSE_ERROR;
|
||||
|
||||
error = gtk_rc_parse_color (scanner, &style->text[state]);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static gint
|
||||
gtk_rc_parse_bg_pixmap (GScanner *scanner,
|
||||
GtkRcStyle *rc_style)
|
||||
|
124
gtk/gtktext.c
124
gtk/gtktext.c
@ -35,7 +35,7 @@
|
||||
#define LINE_DELIM '\n'
|
||||
#define MIN_TEXT_WIDTH_LINES 20
|
||||
#define MIN_TEXT_HEIGHT_LINES 10
|
||||
#define TEXT_BORDER_ROOM 3
|
||||
#define TEXT_BORDER_ROOM 1
|
||||
#define LINE_WRAP_ROOM 8 /* The bitmaps are 6 wide. */
|
||||
#define DEFAULT_TAB_STOP_WIDTH 4
|
||||
#define SCROLL_PIXELS 5
|
||||
@ -513,15 +513,25 @@ void
|
||||
gtk_text_set_editable (GtkText *text,
|
||||
gint editable)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
g_return_if_fail (text != NULL);
|
||||
g_return_if_fail (GTK_IS_TEXT (text));
|
||||
|
||||
widget = GTK_WIDGET (text);
|
||||
GTK_EDITABLE(text)->editable = (editable != FALSE);
|
||||
|
||||
if (editable)
|
||||
draw_cursor (text, TRUE);
|
||||
else
|
||||
undraw_cursor (text, TRUE);
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (widget) &&
|
||||
widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
||||
{
|
||||
gdk_window_clear (widget->window); /* just the border */
|
||||
gtk_widget_queue_draw (widget);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -895,12 +905,9 @@ gtk_text_realize (GtkWidget *widget)
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
/* Can't call gtk_style_set_background here because its handled specially */
|
||||
if (!widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
||||
gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
|
||||
|
||||
if (!widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
||||
gdk_window_set_background (text->text_area, &widget->style->base[GTK_STATE_NORMAL]);
|
||||
/* Can't call gtk_style_set_background here because it's handled specially */
|
||||
gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
|
||||
gdk_window_set_background (text->text_area, &widget->style->base[GTK_STATE_NORMAL]);
|
||||
|
||||
text->line_wrap_bitmap = gdk_bitmap_create_from_data (text->text_area,
|
||||
(gchar*) line_wrap_bits,
|
||||
@ -1059,6 +1066,8 @@ clear_focus_area (GtkText *text, gint area_x, gint area_y, gint area_width, gint
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void
|
||||
gtk_text_draw_focus (GtkWidget *widget)
|
||||
{
|
||||
@ -1073,6 +1082,11 @@ gtk_text_draw_focus (GtkWidget *widget)
|
||||
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
{
|
||||
gint ythick = widget->style->klass->ythickness;
|
||||
gint xthick = widget->style->klass->xthickness;
|
||||
gint xextra = TEXT_BORDER_ROOM;
|
||||
gint yextra = TEXT_BORDER_ROOM;
|
||||
|
||||
TDEBUG (("in gtk_text_draw_focus\n"));
|
||||
|
||||
x = 0;
|
||||
@ -1080,27 +1094,14 @@ gtk_text_draw_focus (GtkWidget *widget)
|
||||
width = widget->allocation.width;
|
||||
height = widget->allocation.height;
|
||||
|
||||
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
||||
{
|
||||
gint ythick = TEXT_BORDER_ROOM + widget->style->klass->ythickness;
|
||||
gint xthick = TEXT_BORDER_ROOM + widget->style->klass->xthickness;
|
||||
|
||||
/* top rect */
|
||||
clear_focus_area (text, 0, 0, width, ythick);
|
||||
/* right rect */
|
||||
clear_focus_area (text, 0, ythick, xthick, height - 2 * ythick);
|
||||
/* left rect */
|
||||
clear_focus_area (text, width - xthick, ythick, xthick, height - 2 * ythick);
|
||||
/* bottom rect */
|
||||
clear_focus_area (text, 0, height - ythick, width, ythick);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_HAS_FOCUS (widget))
|
||||
{
|
||||
x += 1;
|
||||
y += 1;
|
||||
width -= 2;
|
||||
height -= 2;
|
||||
xextra -= 1;
|
||||
yextra -= 1;
|
||||
|
||||
gdk_draw_rectangle (widget->window,
|
||||
widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
@ -1108,19 +1109,38 @@ gtk_text_draw_focus (GtkWidget *widget)
|
||||
widget->allocation.width - 1,
|
||||
widget->allocation.height - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdk_draw_rectangle (widget->window,
|
||||
widget->style->white_gc, FALSE,
|
||||
x + 2,
|
||||
y + 2,
|
||||
width - 1 - 2,
|
||||
height - 1 - 2);
|
||||
}
|
||||
|
||||
gtk_draw_shadow (widget->style, widget->window,
|
||||
GTK_STATE_NORMAL, GTK_SHADOW_IN,
|
||||
x, y, width, height);
|
||||
|
||||
x += xthick;
|
||||
y += ythick;
|
||||
width -= 2 * xthick;
|
||||
height -= 2 * ythick;
|
||||
|
||||
if (widget->style->bg_pixmap[GTK_STATE_NORMAL] &&
|
||||
!GTK_EDITABLE (text)->editable)
|
||||
{
|
||||
/* top rect */
|
||||
clear_focus_area (text, x, y, width, yextra);
|
||||
/* left rect */
|
||||
clear_focus_area (text, x, y + yextra,
|
||||
xextra, y + height - 2 * yextra);
|
||||
/* right rect */
|
||||
clear_focus_area (text, x + width - xextra, y + yextra,
|
||||
xextra, height - 2 * ythick);
|
||||
/* bottom rect */
|
||||
clear_focus_area (text, x, x + height - yextra, width, yextra);
|
||||
}
|
||||
else if (!GTK_WIDGET_HAS_FOCUS (widget))
|
||||
{
|
||||
gdk_draw_rectangle (widget->window,
|
||||
widget->style->base_gc[GTK_STATE_NORMAL], FALSE,
|
||||
x, y,
|
||||
width - 1,
|
||||
height - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1559,6 +1579,8 @@ gtk_text_key_press (GtkWidget *widget,
|
||||
|
||||
if (extend_selection)
|
||||
{
|
||||
editable->has_selection = TRUE;
|
||||
|
||||
if (editable->selection_start_pos == editable->selection_end_pos)
|
||||
{
|
||||
editable->selection_start_pos = text->point.index;
|
||||
@ -3746,7 +3768,9 @@ mark_bg_gc (GtkText* text, const GtkPropertyMark *mark)
|
||||
else
|
||||
return GTK_WIDGET(text)->style->bg_gc[GTK_STATE_ACTIVE];
|
||||
}
|
||||
else if (MARK_CURRENT_BACK (mark))
|
||||
else if (!gdk_color_equal(MARK_CURRENT_BACK (mark),
|
||||
>K_WIDGET(text)->style->base[GTK_STATE_NORMAL]))
|
||||
|
||||
{
|
||||
gdk_gc_set_foreground (text->gc, MARK_CURRENT_BACK (mark));
|
||||
return text->gc;
|
||||
@ -3810,6 +3834,18 @@ draw_line (GtkText* text,
|
||||
pixel_start_height,
|
||||
running_offset,
|
||||
LINE_HEIGHT (*lp));
|
||||
else if (!editable->editable &&
|
||||
GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
rect.x = 0;
|
||||
rect.y = pixel_start_height;
|
||||
rect.width = running_offset;
|
||||
rect.height = LINE_HEIGHT (*lp);
|
||||
|
||||
clear_area (text, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
for (; chars > 0; chars -= len, buffer += len, len = 0)
|
||||
@ -3850,6 +3886,18 @@ draw_line (GtkText* text,
|
||||
pixel_start_height,
|
||||
pixel_width,
|
||||
LINE_HEIGHT(*lp));
|
||||
else if (!editable->editable &&
|
||||
GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
rect.x = running_offset;
|
||||
rect.y = pixel_start_height;
|
||||
rect.width = pixel_width;
|
||||
rect.height = LINE_HEIGHT (*lp);
|
||||
|
||||
clear_area (text, &rect);
|
||||
}
|
||||
|
||||
if ((mark.index >= selection_start_pos) &&
|
||||
(mark.index < selection_end_pos))
|
||||
@ -3983,7 +4031,8 @@ undraw_cursor (GtkText* text, gint absolute)
|
||||
|
||||
font = MARK_CURRENT_FONT(&text->cursor_mark);
|
||||
|
||||
if (GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL])
|
||||
if (GTK_WIDGET (text)->style->bg_pixmap[GTK_STATE_NORMAL] &&
|
||||
!editable->editable)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
|
||||
@ -3996,11 +4045,7 @@ undraw_cursor (GtkText* text, gint absolute)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MARK_CURRENT_BACK (&text->cursor_mark))
|
||||
gdk_gc_set_foreground (text->gc, MARK_CURRENT_BACK (&text->cursor_mark));
|
||||
else
|
||||
gdk_gc_set_foreground (text->gc, >K_WIDGET (text)->style->base[GTK_STATE_NORMAL]);
|
||||
|
||||
gdk_gc_set_foreground (text->gc, MARK_CURRENT_BACK (&text->cursor_mark));
|
||||
gdk_draw_line (text->text_area, text->gc, text->cursor_pos_x,
|
||||
text->cursor_pos_y - text->cursor_char_offset, text->cursor_pos_x,
|
||||
text->cursor_pos_y - text->cursor_char_offset - font->ascent);
|
||||
@ -4093,7 +4138,8 @@ clear_area (GtkText *text, GdkRectangle *area)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (text);
|
||||
|
||||
if (widget->style->bg_pixmap[GTK_STATE_NORMAL])
|
||||
if (widget->style->bg_pixmap[GTK_STATE_NORMAL] &&
|
||||
!GTK_EDITABLE(text)->editable)
|
||||
{
|
||||
gint width, height;
|
||||
gint x = area->x, y = area->y;
|
||||
|
@ -388,6 +388,8 @@ gtk_tree_item_add_pixmaps (GtkTreeItem *tree_item)
|
||||
pixmap_node = g_new (GtkTreePixmaps, 1);
|
||||
|
||||
pixmap_node->colormap = colormap;
|
||||
gdk_colormap_ref (colormap);
|
||||
|
||||
pixmap_node->refcount = 1;
|
||||
|
||||
/* create pixmaps for plus icon */
|
||||
@ -424,6 +426,7 @@ gtk_tree_item_remove_pixmaps (GtkTreeItem *tree_item)
|
||||
|
||||
if (--pixmap_node->refcount == 0)
|
||||
{
|
||||
gdk_colormap_unref (pixmap_node->colormap);
|
||||
gdk_pixmap_unref (pixmap_node->pixmap_plus);
|
||||
gdk_bitmap_unref (pixmap_node->mask_plus);
|
||||
gdk_pixmap_unref (pixmap_node->pixmap_minus);
|
||||
|
@ -2949,6 +2949,8 @@ create_clist ()
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_clist_set_policy (GTK_CLIST (clist), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_clist_set_column_justification (GTK_CLIST (clist), 1, GTK_JUSTIFY_RIGHT);
|
||||
gtk_clist_set_column_justification (GTK_CLIST (clist), 2, GTK_JUSTIFY_CENTER);
|
||||
|
||||
@ -3476,7 +3478,7 @@ create_text ()
|
||||
while (1)
|
||||
{
|
||||
nchars = fread(buffer, 1, 1024, infile);
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black,
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, NULL,
|
||||
NULL, buffer, nchars);
|
||||
|
||||
if (nchars < 1024)
|
||||
|
@ -13,7 +13,7 @@ pixmap_path "."
|
||||
style "default"
|
||||
{
|
||||
fontset = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*,*"
|
||||
# base[NORMAL] = { 1.0, 0.8, 0.8 }
|
||||
# base[NORMAL] = { 0.8, 0.8, 1.0 }
|
||||
}
|
||||
|
||||
style "window"
|
||||
@ -48,8 +48,9 @@ style "toggle_button" = "button"
|
||||
|
||||
style "text"
|
||||
{
|
||||
# bg_pixmap[NORMAL] = "marble.xpm"
|
||||
# fg[NORMAL] = { 1.0, 1.0, 1.0 }
|
||||
bg_pixmap[NORMAL] = "marble.xpm"
|
||||
text[NORMAL] = { 1.0, 1.0, 1.0 }
|
||||
base[NORMAL] = { 0.0, 0.0, 0.0 }
|
||||
}
|
||||
|
||||
style "ruler"
|
||||
@ -62,7 +63,6 @@ style "curve"
|
||||
fg[NORMAL] = { 58000, 0, 0 } # red
|
||||
}
|
||||
|
||||
widget_class "*" style "default"
|
||||
widget_class "GtkWindow" style "window"
|
||||
widget_class "GtkDialog" style "window"
|
||||
widget_class "GtkFileSelection" style "window"
|
||||
@ -71,6 +71,7 @@ widget_class "*GtkCheckButton*" style "toggle_button"
|
||||
widget_class "*GtkRadioButton*" style "toggle_button"
|
||||
widget_class "*GtkButton*" style "button"
|
||||
widget_class "*Ruler" style "ruler"
|
||||
#widget_class "*GtkText" style "text"
|
||||
widget_class "*GtkText" style "text"
|
||||
widget_class "*" style "default"
|
||||
widget "main window.*GtkButton*" style "main_button"
|
||||
widget "*GtkCurve" style "curve"
|
||||
|
@ -2949,6 +2949,8 @@ create_clist ()
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_clist_set_policy (GTK_CLIST (clist), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_clist_set_column_justification (GTK_CLIST (clist), 1, GTK_JUSTIFY_RIGHT);
|
||||
gtk_clist_set_column_justification (GTK_CLIST (clist), 2, GTK_JUSTIFY_CENTER);
|
||||
|
||||
@ -3476,7 +3478,7 @@ create_text ()
|
||||
while (1)
|
||||
{
|
||||
nchars = fread(buffer, 1, 1024, infile);
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, &text->style->black,
|
||||
gtk_text_insert (GTK_TEXT (text), NULL, NULL,
|
||||
NULL, buffer, nchars);
|
||||
|
||||
if (nchars < 1024)
|
||||
|
@ -13,7 +13,7 @@ pixmap_path "."
|
||||
style "default"
|
||||
{
|
||||
fontset = "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*,*"
|
||||
# base[NORMAL] = { 1.0, 0.8, 0.8 }
|
||||
# base[NORMAL] = { 0.8, 0.8, 1.0 }
|
||||
}
|
||||
|
||||
style "window"
|
||||
@ -48,8 +48,9 @@ style "toggle_button" = "button"
|
||||
|
||||
style "text"
|
||||
{
|
||||
# bg_pixmap[NORMAL] = "marble.xpm"
|
||||
# fg[NORMAL] = { 1.0, 1.0, 1.0 }
|
||||
bg_pixmap[NORMAL] = "marble.xpm"
|
||||
text[NORMAL] = { 1.0, 1.0, 1.0 }
|
||||
base[NORMAL] = { 0.0, 0.0, 0.0 }
|
||||
}
|
||||
|
||||
style "ruler"
|
||||
@ -62,7 +63,6 @@ style "curve"
|
||||
fg[NORMAL] = { 58000, 0, 0 } # red
|
||||
}
|
||||
|
||||
widget_class "*" style "default"
|
||||
widget_class "GtkWindow" style "window"
|
||||
widget_class "GtkDialog" style "window"
|
||||
widget_class "GtkFileSelection" style "window"
|
||||
@ -71,6 +71,7 @@ widget_class "*GtkCheckButton*" style "toggle_button"
|
||||
widget_class "*GtkRadioButton*" style "toggle_button"
|
||||
widget_class "*GtkButton*" style "button"
|
||||
widget_class "*Ruler" style "ruler"
|
||||
#widget_class "*GtkText" style "text"
|
||||
widget_class "*GtkText" style "text"
|
||||
widget_class "*" style "default"
|
||||
widget "main window.*GtkButton*" style "main_button"
|
||||
widget "*GtkCurve" style "curve"
|
||||
|
Loading…
Reference in New Issue
Block a user