summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOwen Taylor <owt1@cornell.edu>1998-03-22 21:31:10 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-03-22 21:31:10 +0000
commit16aa9c196416f6bbb60e22f06f62cae8ab4b0196 (patch)
treefa112252cd622b7ca926ae704d7fce65359b76af /tests
parentac05ab301ddc3590ca55b7dec8c2ac472cedc55d (diff)
downloadgdk-pixbuf-16aa9c196416f6bbb60e22f06f62cae8ab4b0196.tar.gz
fixes to locale checks
Sun Mar 22 16:25:46 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkmain.c (gtk_init): fixes to locale checks * gtk/testgtk.c (create_dnd): Create the dnd icons separately to avoid strange interactions with shapes demo. * gtk/gtkentry.[ch]: - Limit the length of the text to 2048 to prevent long delays - Fix problems with buffer overruns - Draw only the onscreen portion of the text to prevent wrapping of shorts in the X drawing code. - Keep track of character positions and x-offsets to speed up algorithms.
Diffstat (limited to 'tests')
-rw-r--r--tests/testgtk.c53
1 files changed, 40 insertions, 13 deletions
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 1caded069..3d6bd8f14 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -23,12 +23,12 @@
#include "circles.xbm"
-/* Variables used by the Drag/Drop and Shape Window demos */
-static GtkWidget *modeller = NULL;
-static GtkWidget *sheets = NULL;
-static GtkWidget *rings = NULL;
-void create_shapes(void);
-
+GtkWidget *shape_create_icon (char *xpm_file,
+ gint x,
+ gint y,
+ gint px,
+ gint py,
+ gint window_type);
/* macro, structure and variables used by tree window demos */
#define DEFAULT_NUMBER_OF_ITEM 3
@@ -4264,16 +4264,40 @@ create_dnd ()
char *possible_drag_types[] = {"text/plain"};
char *accepted_drop_types[] = {"text/plain"};
- if(!modeller)
- create_shapes();
+ static GtkWidget *drag_icon = NULL;
+ static GtkWidget *drop_icon = NULL;
if (!window)
{
GdkPoint hotspot = {5,5};
- gdk_dnd_set_drag_shape(modeller->window,
+ if (!drag_icon)
+ {
+ drag_icon = shape_create_icon ("Modeller.xpm",
+ 440, 140, 0,0, GTK_WINDOW_POPUP);
+
+ gtk_signal_connect (GTK_OBJECT (drag_icon), "destroy",
+ GTK_SIGNAL_FUNC(gtk_widget_destroyed),
+ &drag_icon);
+
+ gtk_widget_hide (drag_icon);
+ }
+
+ if (!drop_icon)
+ {
+ drop_icon = shape_create_icon ("3DRings.xpm",
+ 440, 140, 0,0, GTK_WINDOW_POPUP);
+
+ gtk_signal_connect (GTK_OBJECT (drop_icon), "destroy",
+ GTK_SIGNAL_FUNC(gtk_widget_destroyed),
+ &drop_icon);
+
+ gtk_widget_hide (drop_icon);
+ }
+
+ gdk_dnd_set_drag_shape(drag_icon->window,
&hotspot,
- rings->window,
+ drop_icon->window,
&hotspot);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -4372,8 +4396,6 @@ create_dnd ()
gtk_widget_show (button);
}
- gtk_widget_hide(modeller); gtk_widget_hide(rings);
-
if (!GTK_WIDGET_VISIBLE (window))
gtk_widget_show (window);
else
@@ -4494,13 +4516,18 @@ shape_create_icon (char *xpm_file,
gtk_widget_set_uposition (window, x, y);
gtk_widget_show (window);
-
+
return window;
}
void
create_shapes ()
{
+ /* Variables used by the Drag/Drop and Shape Window demos */
+ static GtkWidget *modeller = NULL;
+ static GtkWidget *sheets = NULL;
+ static GtkWidget *rings = NULL;
+
root_win = gdk_window_foreign_new (GDK_ROOT_WINDOW ());
if (!modeller)