summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <owt1@cornell.edu>1998-04-07 23:59:25 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-04-07 23:59:25 +0000
commit1c77b5f9269a9841b100664dae61a95e1810da38 (patch)
tree5661b1bee144dd558dc1681d34e0a20a13a38ae9
parent13de9dc34f6340cfb33632e717728919d5cec96f (diff)
downloadgtk+-1c77b5f9269a9841b100664dae61a95e1810da38.tar.gz
Removed, because that's what a NULL comparison function means. And it
Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu> * gutils.c (g_direct_compare): Removed, because that's what a NULL comparison function means. And it wasn't 64 bit safe. Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu> * gdk/gdkpixmap.c: Added maximum field widths to prevent possible '%s' scanf overflows. Replaced scanf("%c") with getc(), Don't interpret /*/ as a full comment. Use g_realloc/g_new. * gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0) instead of (GTK_WIDGET_FLAGS(widget) & FLAG) * gtk/gtkfilesel.c: Use getwd() instead of getcwd() on SunOS, because getcwd() hangs up in a wait4(). (Found by David Monniaux <monniaux@clipper.ens.fr>) - Check device/inode/mtime not just inode/mtime, when caching scanned directories. (From: scottk@ig.utexas.edu (Scott Kempf)) * gdk/gdkpixmap.c: Check for 0 width/height when creating pixmaps. * gtk/*.c: Global substitution of recently introduced "MAX (0," for allocations to "MAX (1,", since creating a backing pixmap with a zero width or height fails. * gdk/gdkwindow.c (gdk_window_new): Don't set all the WM properties for child windows. Don't set the base size, since the value we set will be taken as a minimum size.
-rw-r--r--ChangeLog32
-rw-r--r--ChangeLog.pre-2-032
-rw-r--r--ChangeLog.pre-2-1032
-rw-r--r--ChangeLog.pre-2-232
-rw-r--r--ChangeLog.pre-2-432
-rw-r--r--ChangeLog.pre-2-632
-rw-r--r--ChangeLog.pre-2-832
-rw-r--r--TODO19
-rw-r--r--gdk/gdkpixmap.c66
-rw-r--r--gdk/gdkwindow.c24
-rw-r--r--gdk/x11/gdkpixmap-x11.c66
-rw-r--r--gdk/x11/gdkwindow-x11.c24
-rw-r--r--glib/ChangeLog5
-rw-r--r--glib/gutils.c7
-rw-r--r--gtk/gtkaspectframe.c4
-rw-r--r--gtk/gtkbutton.c8
-rw-r--r--gtk/gtkcheckbutton.c4
-rw-r--r--gtk/gtkclist.c16
-rw-r--r--gtk/gtkfilesel.c20
-rw-r--r--gtk/gtkframe.c2
-rw-r--r--gtk/gtkhandlebox.c4
-rw-r--r--gtk/gtkhbox.c6
-rw-r--r--gtk/gtkhpaned.c4
-rw-r--r--gtk/gtklist.c2
-rw-r--r--gtk/gtkmenu.c2
-rw-r--r--gtk/gtkmenubar.c2
-rw-r--r--gtk/gtkmenuitem.c4
-rw-r--r--gtk/gtknotebook.c12
-rw-r--r--gtk/gtkprivate.h14
-rw-r--r--gtk/gtkscrolledwindow.c8
-rw-r--r--gtk/gtktable.c12
-rw-r--r--gtk/gtktree.c2
-rw-r--r--gtk/gtktreeitem.c4
-rw-r--r--gtk/gtkvbox.c6
-rw-r--r--gtk/gtkviewport.c4
-rw-r--r--gtk/gtkvpaned.c4
-rw-r--r--gtk/gtkwidget.h34
-rw-r--r--gtk/gtkwindow.c2
38 files changed, 445 insertions, 170 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e3189715a..af2e0aef83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,35 @@
+Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gdk/gdkpixmap.c: Added maximum field widths to prevent
+ possible '%s' scanf overflows. Replaced scanf("%c")
+ with getc(), Don't interpret /*/ as a full comment. Use
+ g_realloc/g_new.
+
+ * gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
+ tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
+ instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
+
+ * gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
+ SunOS, because getcwd() hangs up in a wait4().
+ (Found by David Monniaux <monniaux@clipper.ens.fr>)
+
+ - Check device/inode/mtime not just inode/mtime, when
+ caching scanned directories.
+ (From: scottk@ig.utexas.edu (Scott Kempf))
+
+ * gdk/gdkpixmap.c: Check for 0 width/height when
+ creating pixmaps.
+
+ * gtk/*.c: Global substitution of recently introduced
+ "MAX (0," for allocations to "MAX (1,", since
+ creating a backing pixmap with a zero width or height
+ fails.
+
+ * gdk/gdkwindow.c (gdk_window_new): Don't set all the
+ WM properties for child windows. Don't set the base
+ size, since the value we set will be taken as a minimum
+ size.
+
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 6e3189715a..af2e0aef83 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,35 @@
+Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gdk/gdkpixmap.c: Added maximum field widths to prevent
+ possible '%s' scanf overflows. Replaced scanf("%c")
+ with getc(), Don't interpret /*/ as a full comment. Use
+ g_realloc/g_new.
+
+ * gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
+ tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
+ instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
+
+ * gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
+ SunOS, because getcwd() hangs up in a wait4().
+ (Found by David Monniaux <monniaux@clipper.ens.fr>)
+
+ - Check device/inode/mtime not just inode/mtime, when
+ caching scanned directories.
+ (From: scottk@ig.utexas.edu (Scott Kempf))
+
+ * gdk/gdkpixmap.c: Check for 0 width/height when
+ creating pixmaps.
+
+ * gtk/*.c: Global substitution of recently introduced
+ "MAX (0," for allocations to "MAX (1,", since
+ creating a backing pixmap with a zero width or height
+ fails.
+
+ * gdk/gdkwindow.c (gdk_window_new): Don't set all the
+ WM properties for child windows. Don't set the base
+ size, since the value we set will be taken as a minimum
+ size.
+
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 6e3189715a..af2e0aef83 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,35 @@
+Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gdk/gdkpixmap.c: Added maximum field widths to prevent
+ possible '%s' scanf overflows. Replaced scanf("%c")
+ with getc(), Don't interpret /*/ as a full comment. Use
+ g_realloc/g_new.
+
+ * gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
+ tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
+ instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
+
+ * gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
+ SunOS, because getcwd() hangs up in a wait4().
+ (Found by David Monniaux <monniaux@clipper.ens.fr>)
+
+ - Check device/inode/mtime not just inode/mtime, when
+ caching scanned directories.
+ (From: scottk@ig.utexas.edu (Scott Kempf))
+
+ * gdk/gdkpixmap.c: Check for 0 width/height when
+ creating pixmaps.
+
+ * gtk/*.c: Global substitution of recently introduced
+ "MAX (0," for allocations to "MAX (1,", since
+ creating a backing pixmap with a zero width or height
+ fails.
+
+ * gdk/gdkwindow.c (gdk_window_new): Don't set all the
+ WM properties for child windows. Don't set the base
+ size, since the value we set will be taken as a minimum
+ size.
+
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 6e3189715a..af2e0aef83 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,35 @@
+Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gdk/gdkpixmap.c: Added maximum field widths to prevent
+ possible '%s' scanf overflows. Replaced scanf("%c")
+ with getc(), Don't interpret /*/ as a full comment. Use
+ g_realloc/g_new.
+
+ * gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
+ tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
+ instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
+
+ * gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
+ SunOS, because getcwd() hangs up in a wait4().
+ (Found by David Monniaux <monniaux@clipper.ens.fr>)
+
+ - Check device/inode/mtime not just inode/mtime, when
+ caching scanned directories.
+ (From: scottk@ig.utexas.edu (Scott Kempf))
+
+ * gdk/gdkpixmap.c: Check for 0 width/height when
+ creating pixmaps.
+
+ * gtk/*.c: Global substitution of recently introduced
+ "MAX (0," for allocations to "MAX (1,", since
+ creating a backing pixmap with a zero width or height
+ fails.
+
+ * gdk/gdkwindow.c (gdk_window_new): Don't set all the
+ WM properties for child windows. Don't set the base
+ size, since the value we set will be taken as a minimum
+ size.
+
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 6e3189715a..af2e0aef83 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,35 @@
+Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gdk/gdkpixmap.c: Added maximum field widths to prevent
+ possible '%s' scanf overflows. Replaced scanf("%c")
+ with getc(), Don't interpret /*/ as a full comment. Use
+ g_realloc/g_new.
+
+ * gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
+ tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
+ instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
+
+ * gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
+ SunOS, because getcwd() hangs up in a wait4().
+ (Found by David Monniaux <monniaux@clipper.ens.fr>)
+
+ - Check device/inode/mtime not just inode/mtime, when
+ caching scanned directories.
+ (From: scottk@ig.utexas.edu (Scott Kempf))
+
+ * gdk/gdkpixmap.c: Check for 0 width/height when
+ creating pixmaps.
+
+ * gtk/*.c: Global substitution of recently introduced
+ "MAX (0," for allocations to "MAX (1,", since
+ creating a backing pixmap with a zero width or height
+ fails.
+
+ * gdk/gdkwindow.c (gdk_window_new): Don't set all the
+ WM properties for child windows. Don't set the base
+ size, since the value we set will be taken as a minimum
+ size.
+
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 6e3189715a..af2e0aef83 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,35 @@
+Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gdk/gdkpixmap.c: Added maximum field widths to prevent
+ possible '%s' scanf overflows. Replaced scanf("%c")
+ with getc(), Don't interpret /*/ as a full comment. Use
+ g_realloc/g_new.
+
+ * gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
+ tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
+ instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
+
+ * gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
+ SunOS, because getcwd() hangs up in a wait4().
+ (Found by David Monniaux <monniaux@clipper.ens.fr>)
+
+ - Check device/inode/mtime not just inode/mtime, when
+ caching scanned directories.
+ (From: scottk@ig.utexas.edu (Scott Kempf))
+
+ * gdk/gdkpixmap.c: Check for 0 width/height when
+ creating pixmaps.
+
+ * gtk/*.c: Global substitution of recently introduced
+ "MAX (0," for allocations to "MAX (1,", since
+ creating a backing pixmap with a zero width or height
+ fails.
+
+ * gdk/gdkwindow.c (gdk_window_new): Don't set all the
+ WM properties for child windows. Don't set the base
+ size, since the value we set will be taken as a minimum
+ size.
+
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 6e3189715a..af2e0aef83 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,35 @@
+Tue Apr 7 19:14:03 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gdk/gdkpixmap.c: Added maximum field widths to prevent
+ possible '%s' scanf overflows. Replaced scanf("%c")
+ with getc(), Don't interpret /*/ as a full comment. Use
+ g_realloc/g_new.
+
+ * gtk/gtkwidget.h gtk/gtkprivate.h: Changed all flag
+ tests to check for ((GTK_WIDGET_FLAGS(widget) & FLAG) != 0)
+ instead of (GTK_WIDGET_FLAGS(widget) & FLAG)
+
+ * gtk/gtkfilesel.c: Use getwd() instead of getcwd() on
+ SunOS, because getcwd() hangs up in a wait4().
+ (Found by David Monniaux <monniaux@clipper.ens.fr>)
+
+ - Check device/inode/mtime not just inode/mtime, when
+ caching scanned directories.
+ (From: scottk@ig.utexas.edu (Scott Kempf))
+
+ * gdk/gdkpixmap.c: Check for 0 width/height when
+ creating pixmaps.
+
+ * gtk/*.c: Global substitution of recently introduced
+ "MAX (0," for allocations to "MAX (1,", since
+ creating a backing pixmap with a zero width or height
+ fails.
+
+ * gdk/gdkwindow.c (gdk_window_new): Don't set all the
+ WM properties for child windows. Don't set the base
+ size, since the value we set will be taken as a minimum
+ size.
+
Wed Apr 8 00:00:48 1998 Tim Janik <timj@gtk.org>
* gtk/gtklabel.c (gtk_label_expose): don't take '\n' into account for
diff --git a/TODO b/TODO
index f1b0f971ed..101a219e2c 100644
--- a/TODO
+++ b/TODO
@@ -99,6 +99,9 @@ TODO AFTER GTK 1.0
* Entry should have a password mode (and it should show stars
for user feedback).
+ * Entry should allow set_usize to work better, and should compute
+ a different width when a maximum length is used.
+
* More dialogs: Print, GtkFontSelector, maybe others...
* Multiple document interface (MDI)?
@@ -191,13 +194,13 @@ TODO AFTER GTK 1.0
aaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
as:
- | Maximum column
+ | Maximum column
aaaaaaaaaaa bbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbb |
Instead of:
- |
+ |
aaaaaaaaaaa |
bbbbbbbbbbbbbbbbbbbbbbb|
bbbbbbbbbbbbbbbbbbbb |
@@ -212,6 +215,8 @@ TODO AFTER GTK 1.0
- Really big font (150 pt), plus lots of editing caused segfault
+ - "changed" emitted when doing deletes on empty Text widget.
+
? Allow moving the separator for paned widgets by dragging
it directly instead of using the handle.
@@ -257,3 +262,13 @@ TODO AFTER GTK 1.0
Fix: Only send GDK_EVENT_CONFIGURE when the window is resized,
create a new event type for toplevel motion. (GDK_EVENT_REPOSITION?)
and eliminate the resize count in GtkWindow.
+
+ * Generic ScrolledWindow interface, which provide automatic scrollbar
+ capability to Viewport, Text, and CList widgets.
+
+ GTK_POLICY_NEVER for scrolled windows.
+
+ * Consider caching more state in GdkWindowPrivate. Currently,
+ every widget realization involves a XGetGeometry and a
+ XGetWindowAttributes. And every GdkWindow destruction
+ involves a XQueryTree.
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
index 1ec059cda1..61f97732e4 100644
--- a/gdk/gdkpixmap.c
+++ b/gdk/gdkpixmap.c
@@ -44,6 +44,7 @@ gdk_pixmap_new (GdkWindow *window,
GdkWindowPrivate *window_private;
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
+ g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
@@ -87,6 +88,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
GdkWindowPrivate *window_private;
g_return_val_if_fail (data != NULL, NULL);
+ g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
@@ -135,6 +137,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
+ g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
@@ -179,13 +182,13 @@ gdk_pixmap_seek_string (FILE *infile,
while (!feof (infile))
{
- fscanf (infile, "%s", instr);
+ fscanf (infile, "%1023s", instr);
if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
{
- fscanf (infile, "%s", instr);
+ fscanf (infile, "%1023s", instr);
while (!feof (infile) && strcmp (instr, "*/") != 0)
- fscanf (infile, "%s", instr);
- fscanf(infile, "%s", instr);
+ fscanf (infile, "%1023s", instr);
+ fscanf(infile, "%1023s", instr);
}
if (strcmp (instr, str)==0)
return TRUE;
@@ -198,29 +201,31 @@ gint
gdk_pixmap_seek_char (FILE *infile,
gchar c)
{
- gchar b, oldb;
+ gint b, oldb;
- while (!feof (infile))
+ while ((b = getc(infile)) != EOF)
{
- fscanf(infile, "%c", &b);
if (c != b && b == '/')
- {
- fscanf (infile, "%c", &b);
- if (b == '*')
- {
- oldb = b;
- while (!feof (infile) && !(oldb == '*' && b == '/'))
- {
- oldb = b;
- fscanf (infile, "%c", &b);
- }
- fscanf (infile, "%c", &b);
- }
+ {
+ b = getc (infile);
+ if (b == EOF)
+ return FALSE;
+ else if (b == '*') /* we have a comment */
+ {
+ b = -1;
+ do
+ {
+ oldb = b;
+ b = getc (infile);
+ if (b == EOF)
+ return FALSE;
+ }
+ while (!(oldb == '*' && b == '/'));
+ }
}
- if (c == b)
- return TRUE;
+ else if (c == b)
+ return TRUE;
}
-
return FALSE;
}
@@ -229,31 +234,28 @@ gdk_pixmap_read_string (FILE *infile,
gchar **buffer,
guint *buffer_size)
{
- gchar c;
+ gint c;
guint cnt = 0;
if ((*buffer) == NULL)
{
(*buffer_size) = 10 * sizeof (gchar);
- (*buffer) = (gchar *) malloc (*buffer_size);
+ (*buffer) = g_new(gchar, *buffer_size);
}
do
- fscanf (infile, "%c", &c);
- while (!feof (infile) && c != '"');
+ c = getc (infile);
+ while (c != EOF && c != '"');
if (c != '"')
return FALSE;
- while (!feof (infile))
+ while ((c = getc(infile)) != EOF)
{
- fscanf (infile, "%c", &c);
-
if (cnt == (*buffer_size))
{
(*buffer_size) *= 2;
- (*buffer) = (gchar *) realloc ((*buffer), *buffer_size);
- }
+ (*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size); }
if (c != '"')
(*buffer)[cnt++] = c;
@@ -329,7 +331,7 @@ gdk_pixmap_extract_color (gchar *buffer)
while (finished == FALSE)
{
- sscanf (ptr, "%s", temp);
+ sscanf (ptr, "%127s", temp);
if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 ||
strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0)
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 5092070a2e..f5de78cc3f 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -355,6 +355,10 @@ gdk_window_new (GdkWindow *parent,
gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
+ gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
+ (attributes->cursor) :
+ NULL));
+
switch (private->window_type)
{
case GDK_WINDOW_DIALOG:
@@ -368,26 +372,31 @@ gdk_window_new (GdkWindow *parent,
(colormap != gdk_colormap_get_system ()) &&
(colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
{
- g_print ("adding colormap window\n");
+ GDK_NOTE (MISC, g_print ("adding colormap window\n"));
gdk_window_add_colormap_windows (window);
}
- break;
+
+ return window;
default:
- break;
+
+ return window;
}
- size_hints.flags = PSize | PBaseSize;
+ size_hints.flags = PSize;
size_hints.width = private->width;
size_hints.height = private->height;
- size_hints.base_width = private->width;
- size_hints.base_height = private->height;
wm_hints.flags = InputHint | StateHint | WindowGroupHint;
wm_hints.window_group = gdk_leader_window;
wm_hints.input = True;
wm_hints.initial_state = NormalState;
+ /* FIXME: Is there any point in doing this? Do any WM's pay
+ * attention to PSize, and even if they do, is this the
+ * correct value???
+ */
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
+
XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
if (attributes_mask & GDK_WA_TITLE)
@@ -409,9 +418,6 @@ gdk_window_new (GdkWindow *parent,
XFree (class_hint);
}
- gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
- (attributes->cursor) :
- NULL));
return window;
}
diff --git a/gdk/x11/gdkpixmap-x11.c b/gdk/x11/gdkpixmap-x11.c
index 1ec059cda1..61f97732e4 100644
--- a/gdk/x11/gdkpixmap-x11.c
+++ b/gdk/x11/gdkpixmap-x11.c
@@ -44,6 +44,7 @@ gdk_pixmap_new (GdkWindow *window,
GdkWindowPrivate *window_private;
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
+ g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
@@ -87,6 +88,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
GdkWindowPrivate *window_private;
g_return_val_if_fail (data != NULL, NULL);
+ g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
@@ -135,6 +137,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
g_return_val_if_fail (fg != NULL, NULL);
g_return_val_if_fail (bg != NULL, NULL);
g_return_val_if_fail ((window != NULL) || (depth != -1), NULL);
+ g_return_val_if_fail ((width != 0) && (height != 0), NULL);
if (!window)
window = (GdkWindow*) &gdk_root_parent;
@@ -179,13 +182,13 @@ gdk_pixmap_seek_string (FILE *infile,
while (!feof (infile))
{
- fscanf (infile, "%s", instr);
+ fscanf (infile, "%1023s", instr);
if (skip_comments == TRUE && strcmp (instr, "/*") == 0)
{
- fscanf (infile, "%s", instr);
+ fscanf (infile, "%1023s", instr);
while (!feof (infile) && strcmp (instr, "*/") != 0)
- fscanf (infile, "%s", instr);
- fscanf(infile, "%s", instr);
+ fscanf (infile, "%1023s", instr);
+ fscanf(infile, "%1023s", instr);
}
if (strcmp (instr, str)==0)
return TRUE;
@@ -198,29 +201,31 @@ gint
gdk_pixmap_seek_char (FILE *infile,
gchar c)
{
- gchar b, oldb;
+ gint b, oldb;
- while (!feof (infile))
+ while ((b = getc(infile)) != EOF)
{
- fscanf(infile, "%c", &b);
if (c != b && b == '/')
- {
- fscanf (infile, "%c", &b);
- if (b == '*')
- {
- oldb = b;
- while (!feof (infile) && !(oldb == '*' && b == '/'))
- {
- oldb = b;
- fscanf (infile, "%c", &b);
- }
- fscanf (infile, "%c", &b);
- }
+ {
+ b = getc (infile);
+ if (b == EOF)
+ return FALSE;
+ else if (b == '*') /* we have a comment */
+ {
+ b = -1;
+ do
+ {
+ oldb = b;
+ b = getc (infile);
+ if (b == EOF)
+ return FALSE;
+ }
+ while (!(oldb == '*' && b == '/'));
+ }
}
- if (c == b)
- return TRUE;
+ else if (c == b)
+ return TRUE;
}
-
return FALSE;
}
@@ -229,31 +234,28 @@ gdk_pixmap_read_string (FILE *infile,
gchar **buffer,
guint *buffer_size)
{
- gchar c;
+ gint c;
guint cnt = 0;
if ((*buffer) == NULL)
{
(*buffer_size) = 10 * sizeof (gchar);
- (*buffer) = (gchar *) malloc (*buffer_size);
+ (*buffer) = g_new(gchar, *buffer_size);
}
do
- fscanf (infile, "%c", &c);
- while (!feof (infile) && c != '"');
+ c = getc (infile);
+ while (c != EOF && c != '"');
if (c != '"')
return FALSE;
- while (!feof (infile))
+ while ((c = getc(infile)) != EOF)
{
- fscanf (infile, "%c", &c);
-
if (cnt == (*buffer_size))
{
(*buffer_size) *= 2;
- (*buffer) = (gchar *) realloc ((*buffer), *buffer_size);
- }
+ (*buffer) = (gchar *) g_realloc ((*buffer), *buffer_size); }
if (c != '"')
(*buffer)[cnt++] = c;
@@ -329,7 +331,7 @@ gdk_pixmap_extract_color (gchar *buffer)
while (finished == FALSE)
{
- sscanf (ptr, "%s", temp);
+ sscanf (ptr, "%127s", temp);
if ((gint)ptr[0] == 0 || strcmp ("s", temp) == 0 || strcmp ("m", temp) == 0 ||
strcmp ("g", temp) == 0 || strcmp ("g4", temp) == 0)
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 5092070a2e..f5de78cc3f 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -355,6 +355,10 @@ gdk_window_new (GdkWindow *parent,
gdk_window_ref (window);
gdk_xid_table_insert (&private->xwindow, window);
+ gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
+ (attributes->cursor) :
+ NULL));
+
switch (private->window_type)
{
case GDK_WINDOW_DIALOG:
@@ -368,26 +372,31 @@ gdk_window_new (GdkWindow *parent,
(colormap != gdk_colormap_get_system ()) &&
(colormap != gdk_window_get_colormap (gdk_window_get_toplevel (window))))
{
- g_print ("adding colormap window\n");
+ GDK_NOTE (MISC, g_print ("adding colormap window\n"));
gdk_window_add_colormap_windows (window);
}
- break;
+
+ return window;
default:
- break;
+
+ return window;
}
- size_hints.flags = PSize | PBaseSize;
+ size_hints.flags = PSize;
size_hints.width = private->width;
size_hints.height = private->height;
- size_hints.base_width = private->width;
- size_hints.base_height = private->height;
wm_hints.flags = InputHint | StateHint | WindowGroupHint;
wm_hints.window_group = gdk_leader_window;
wm_hints.input = True;
wm_hints.initial_state = NormalState;
+ /* FIXME: Is there any point in doing this? Do any WM's pay
+ * attention to PSize, and even if they do, is this the
+ * correct value???
+ */
XSetWMNormalHints (private->xdisplay, private->xwindow, &size_hints);
+
XSetWMHints (private->xdisplay, private->xwindow, &wm_hints);
if (attributes_mask & GDK_WA_TITLE)
@@ -409,9 +418,6 @@ gdk_window_new (GdkWindow *parent,
XFree (class_hint);
}
- gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
- (attributes->cursor) :
- NULL));
return window;
}
diff --git a/glib/ChangeLog b/glib/ChangeLog
index 31308f5695..2ab8ab1f9b 100644
--- a/glib/ChangeLog
+++ b/glib/ChangeLog
@@ -1,3 +1,8 @@
+Tue Apr 7 19:36:48 1998 Owen Taylor <owt1@cornell.edu>
+
+ * gutils.c (g_direct_compare): Removed, because that's what
+ a NULL comparison function means. And it wasn't 64 bit safe.
+
Mon Apr 6 18:43:25 1998 Tim Janik <timj@gtk.org>
* gscanner.c (g_scanner_get_token_ll): fixed a bug that caused floats
diff --git a/glib/gutils.c b/glib/gutils.c
index 9f38714243..f9b5f94ca5 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -912,11 +912,6 @@ g_parse_debug_string (const gchar *string,
guint
g_direct_hash(gpointer key)
{
- return (guint)key;
+ return (guint)key;
}
-gint
-g_direct_compare(gpointer a, gpointer b)
-{
- return (gint)b - (gint)a;
-}
diff --git a/gtk/gtkaspectframe.c b/gtk/gtkaspectframe.c
index fd05844f1a..c59f8f9d5b 100644
--- a/gtk/gtkaspectframe.c
+++ b/gtk/gtkaspectframe.c
@@ -316,8 +316,8 @@ gtk_aspect_frame_size_allocate (GtkWidget *widget,
/* make sure we don't allocate a negative width or height,
* since that will be cast to a (very big) guint16 */
- width = MAX (0, width);
- height = MAX (0, height);
+ width = MAX (1, width);
+ height = MAX (1, height);
if (ratio * height > width)
{
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 17b9a56d73..e371d50ae4 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -421,9 +421,9 @@ gtk_button_size_allocate (GtkWidget *widget,
child_allocation.x = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->xthickness);
child_allocation.y = (CHILD_SPACING + GTK_WIDGET (widget)->style->klass->ythickness);
- child_allocation.width = MAX (0, widget->allocation.width - child_allocation.x * 2 -
+ child_allocation.width = MAX (1, widget->allocation.width - child_allocation.x * 2 -
border_width * 2);
- child_allocation.height = MAX (0, widget->allocation.height - child_allocation.y * 2 -
+ child_allocation.height = MAX (1, widget->allocation.height - child_allocation.y * 2 -
border_width * 2);
if (GTK_WIDGET_CAN_DEFAULT (button))
@@ -432,9 +432,9 @@ gtk_button_size_allocate (GtkWidget *widget,
DEFAULT_LEFT_POS);
child_allocation.y += (GTK_WIDGET (widget)->style->klass->ythickness +
DEFAULT_TOP_POS);
- child_allocation.width = MAX (0, child_allocation.width -
+ child_allocation.width = MAX (1, child_allocation.width -
(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
- child_allocation.height = MAX (0, child_allocation.height -
+ child_allocation.height = MAX (1, child_allocation.height -
(GTK_WIDGET (widget)->style->klass->xthickness * 2 + DEFAULT_SPACING));
}
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c
index 239d0252e5..834e954e4b 100644
--- a/gtk/gtkcheckbutton.c
+++ b/gtk/gtkcheckbutton.c
@@ -249,9 +249,9 @@ gtk_check_button_size_allocate (GtkWidget *widget,
CHECK_BUTTON_CLASS (widget)->indicator_size +
CHECK_BUTTON_CLASS (widget)->indicator_spacing * 3 + 1);
child_allocation.y = GTK_CONTAINER (widget)->border_width + 1;
- child_allocation.width = MAX (0, allocation->width - child_allocation.x -
+ child_allocation.width = MAX (1, allocation->width - child_allocation.x -
GTK_CONTAINER (widget)->border_width - 1);
- child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
+ child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
gtk_widget_size_allocate (button->child, &child_allocation);
}
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 8eabcad5db..f473289817 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -2244,18 +2244,18 @@ gtk_clist_size_allocate (GtkWidget * widget,
* border width */
clist->internal_allocation.x = 0;
clist->internal_allocation.y = 0;
- clist->internal_allocation.width = MAX (0, allocation->width -
+ clist->internal_allocation.width = MAX (1, allocation->width -
GTK_CONTAINER (widget)->border_width * 2);
- clist->internal_allocation.height = MAX (0, allocation->height -
+ clist->internal_allocation.height = MAX (1, allocation->height -
GTK_CONTAINER (widget)->border_width * 2);
/* allocate clist window assuming no scrollbars */
clist_allocation.x = clist->internal_allocation.x + widget->style->klass->xthickness;
clist_allocation.y = clist->internal_allocation.y + widget->style->klass->ythickness +
clist->column_title_area.height;
- clist_allocation.width = MAX (0, clist->internal_allocation.width -
+ clist_allocation.width = MAX (1, clist->internal_allocation.width -
(2 * widget->style->klass->xthickness));
- clist_allocation.height = MAX (0, clist->internal_allocation.height -
+ clist_allocation.height = MAX (1, clist->internal_allocation.height -
(2 * widget->style->klass->ythickness) -
clist->column_title_area.height);
@@ -2277,7 +2277,7 @@ gtk_clist_size_allocate (GtkWidget * widget,
if (!vscrollbar_vis)
{
vscrollbar_vis = 1;
- clist_allocation.width = MAX (0, clist_allocation.width -
+ clist_allocation.width = MAX (1, clist_allocation.width -
(clist->vscrollbar->requisition.width +
SCROLLBAR_SPACING (clist)));
}
@@ -2293,7 +2293,7 @@ gtk_clist_size_allocate (GtkWidget * widget,
if (!hscrollbar_vis)
{
hscrollbar_vis = 1;
- clist_allocation.height = MAX (0, clist_allocation.height -
+ clist_allocation.height = MAX (1, clist_allocation.height -
(clist->hscrollbar->requisition.height +
SCROLLBAR_SPACING (clist)));
}
@@ -2345,7 +2345,7 @@ gtk_clist_size_allocate (GtkWidget * widget,
clist->vscrollbar->requisition.width;
child_allocation.y = clist->internal_allocation.y;
child_allocation.width = clist->vscrollbar->requisition.width;
- child_allocation.height = MAX (0, clist->internal_allocation.height -
+ child_allocation.height = MAX (1, clist->internal_allocation.height -
(hscrollbar_vis ? (clist->hscrollbar->requisition.height + SCROLLBAR_SPACING (clist)) : 0));
gtk_widget_size_allocate (clist->vscrollbar, &child_allocation);
@@ -2365,7 +2365,7 @@ gtk_clist_size_allocate (GtkWidget * widget,
child_allocation.y = clist->internal_allocation.y +
clist->internal_allocation.height -
clist->hscrollbar->requisition.height;
- child_allocation.width = MAX (0, clist->internal_allocation.width -
+ child_allocation.width = MAX (1, clist->internal_allocation.width -
(vscrollbar_vis ? (clist->vscrollbar->requisition.width + SCROLLBAR_SPACING (clist)) : 0));
child_allocation.height = clist->hscrollbar->requisition.height;
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index a334c73f8c..f0e50a20ea 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -93,6 +93,7 @@ struct _CompletionDirSent
{
ino_t inode;
time_t mtime;
+ dev_t device;
gint entry_count;
gchar *name_buffer; /* memory segment containing names of all entries */
@@ -1504,7 +1505,14 @@ cmpl_init_state (void)
new_state = g_new (CompletionState, 1);
+ /* We don't use getcwd() on SUNOS, because, it does a popen("pwd")
+ * and, if that wasn't bad enough, hangs in doing so.
+ */
+#if defined(sun) && !defined(__SVR4)
+ if (!getwd (getcwd_buf))
+#else
if (!getcwd (getcwd_buf, MAXPATHLEN))
+#endif
{
cmpl_errno = errno;
return NULL;
@@ -1856,6 +1864,7 @@ open_new_dir(gchar* dir_name, struct stat* sbuf)
sent = g_new(CompletionDirSent, 1);
sent->mtime = sbuf->st_mtime;
sent->inode = sbuf->st_ino;
+ sent->device = sbuf->st_dev;
path_buf_len = strlen(dir_name);
@@ -1953,7 +1962,8 @@ open_dir(gchar* dir_name, CompletionState* cmpl_state)
sent = cdsl->data;
if(sent->inode == sbuf.st_ino &&
- sent->mtime == sbuf.st_mtime)
+ sent->mtime == sbuf.st_mtime &&
+ sent->device == sbuf.st_dev)
return attach_dir(sent, dir_name, cmpl_state);
cdsl = cdsl->next;
@@ -2108,7 +2118,11 @@ find_parent_dir_fullname(gchar* dirname)
gchar buffer[MAXPATHLEN];
gchar buffer2[MAXPATHLEN];
+#if defined(sun) && !defined(__SVR4)
+ if(!getwd(buffer))
+#else
if(!getcwd(buffer, MAXPATHLEN))
+#endif
{
cmpl_errno = errno;
return NULL;
@@ -2120,7 +2134,11 @@ find_parent_dir_fullname(gchar* dirname)
return NULL;
}
+#if defined(sun) && !defined(__SVR4)
+ if(!getwd(buffer2))
+#else
if(!getcwd(buffer2, MAXPATHLEN))
+#endif
{
chdir(buffer);
cmpl_errno = errno;
diff --git a/gtk/gtkframe.c b/gtk/gtkframe.c
index d1f5189c3c..2baf191e49 100644
--- a/gtk/gtkframe.c
+++ b/gtk/gtkframe.c
@@ -493,7 +493,7 @@ gtk_frame_size_allocate (GtkWidget *widget,
child_allocation.y = (GTK_CONTAINER (frame)->border_width +
MAX (frame->label_height, GTK_WIDGET (frame)->style->klass->ythickness));
- child_allocation.height = MAX (0, (allocation->height - child_allocation.y -
+ child_allocation.height = MAX (1, (allocation->height - child_allocation.y -
GTK_CONTAINER (frame)->border_width -
GTK_WIDGET (frame)->style->klass->ythickness));
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c
index 83aff1d370..aff7afd002 100644
--- a/gtk/gtkhandlebox.c
+++ b/gtk/gtkhandlebox.c
@@ -514,8 +514,8 @@ gtk_handle_box_size_allocate (GtkWidget *widget,
}
else
{
- child_allocation.width = MAX (0, widget->allocation.width - 2 * border_width);
- child_allocation.height = MAX (0, widget->allocation.height - 2 * border_width);
+ child_allocation.width = MAX (1, widget->allocation.width - 2 * border_width);
+ child_allocation.height = MAX (1, widget->allocation.height - 2 * border_width);
if (hb->handle_position == GTK_POS_LEFT ||
hb->handle_position == GTK_POS_RIGHT)
diff --git a/gtk/gtkhbox.c b/gtk/gtkhbox.c
index eb46104d65..2d9fc0ec57 100644
--- a/gtk/gtkhbox.c
+++ b/gtk/gtkhbox.c
@@ -198,7 +198,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
x = allocation->x + GTK_CONTAINER (box)->border_width;
child_allocation.y = allocation->y + GTK_CONTAINER (box)->border_width;
- child_allocation.height = MAX (0, allocation->height - GTK_CONTAINER (box)->border_width * 2);
+ child_allocation.height = MAX (1, allocation->height - GTK_CONTAINER (box)->border_width * 2);
children = box->children;
while (children)
@@ -236,7 +236,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
if (child->fill)
{
- child_allocation.width = MAX (0, child_width - child->padding * 2);
+ child_allocation.width = MAX (1, child_width - child->padding * 2);
child_allocation.x = x + child->padding;
}
else
@@ -289,7 +289,7 @@ gtk_hbox_size_allocate (GtkWidget *widget,
if (child->fill)
{
- child_allocation.width = MAX (0, child_width - child->padding * 2);
+ child_allocation.width = MAX (1, child_width - child->padding * 2);
child_allocation.x = x + child->padding - child_width;
}
else
diff --git a/gtk/gtkhpaned.c b/gtk/gtkhpaned.c
index 07bff9e6a1..59ac473308 100644
--- a/gtk/gtkhpaned.c
+++ b/gtk/gtkhpaned.c
@@ -177,7 +177,7 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.height);
}
- child1_allocation.height = child2_allocation.height = MAX (0, allocation->height - border_width * 2);
+ child1_allocation.height = child2_allocation.height = MAX (1, allocation->height - border_width * 2);
child1_allocation.width = paned->child1_size;
child1_allocation.x = border_width;
child1_allocation.y = child2_allocation.y = border_width;
@@ -189,7 +189,7 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.height = allocation->height;
child2_allocation.x = paned->groove_rectangle.x + paned->gutter_size / 2 + 1;
- child2_allocation.width = MAX (0, allocation->width
+ child2_allocation.width = MAX (1, allocation->width
- child2_allocation.x - border_width);
/* Now allocate the childen, making sure, when resizing not to
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index 076777be81..3589e0b060 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -789,7 +789,7 @@ gtk_list_size_allocate (GtkWidget *widget,
{
child_allocation.x = GTK_CONTAINER (list)->border_width;
child_allocation.y = GTK_CONTAINER (list)->border_width;
- child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
+ child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
children = list->children;
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 6dc66c55c9..a7f81aa3af 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -641,7 +641,7 @@ gtk_menu_size_allocate (GtkWidget *widget,
widget->style->klass->xthickness);
child_allocation.y = (GTK_CONTAINER (menu)->border_width +
widget->style->klass->ythickness);
- child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
+ child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
children = menu_shell->children;
while (children)
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index bb849bece8..0499710969 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -206,7 +206,7 @@ gtk_menu_bar_size_allocate (GtkWidget *widget,
child_allocation.y = (GTK_CONTAINER (menu_bar)->border_width +
widget->style->klass->ythickness +
BORDER_SPACING);
- child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
+ child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
children = menu_shell->children;
while (children)
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 152d427575..2ee80e73a4 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -395,8 +395,8 @@ gtk_menu_item_size_allocate (GtkWidget *widget,
widget->style->klass->xthickness +
BORDER_SPACING);
child_allocation.y = GTK_CONTAINER (widget)->border_width;
- child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
- child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
+ child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
+ child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
child_allocation.x += GTK_MENU_ITEM (widget)->toggle_size;
child_allocation.width -= (GTK_MENU_ITEM (widget)->toggle_size +
GTK_MENU_ITEM (widget)->accelerator_size);
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index a3f5bdcba7..05174d3b6e 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -1162,16 +1162,16 @@ gtk_notebook_size_allocate (GtkWidget *widget,
{
child_allocation.x = GTK_CONTAINER (widget)->border_width;
child_allocation.y = GTK_CONTAINER (widget)->border_width;
- child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
- child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
+ child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
+ child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
if (notebook->show_tabs || notebook->show_border)
{
child_allocation.x += widget->style->klass->xthickness;
child_allocation.y += widget->style->klass->ythickness;
- child_allocation.width = MAX (0,
+ child_allocation.width = MAX (1,
child_allocation.width - widget->style->klass->xthickness * 2);
- child_allocation.height = MAX (0,
+ child_allocation.height = MAX (1,
child_allocation.height - widget->style->klass->ythickness * 2);
if (notebook->show_tabs && notebook->children)
@@ -1181,13 +1181,13 @@ gtk_notebook_size_allocate (GtkWidget *widget,
case GTK_POS_TOP:
child_allocation.y += notebook->cur_page->requisition.height;
case GTK_POS_BOTTOM:
- child_allocation.height = MAX (0,
+ child_allocation.height = MAX (1,
child_allocation.height - notebook->cur_page->requisition.height);
break;
case GTK_POS_LEFT:
child_allocation.x += notebook->cur_page->requisition.width;
case GTK_POS_RIGHT:
- child_allocation.width = MAX (0,
+ child_allocation.width = MAX (1,
child_allocation.width - notebook->cur_page->requisition.width);
break;
}
diff --git a/gtk/gtkprivate.h b/gtk/gtkprivate.h
index 2164f0998e..8ac037a83b 100644
--- a/gtk/gtkprivate.h
+++ b/gtk/gtkprivate.h
@@ -45,13 +45,13 @@ enum
/* Macros for extracting a widgets private_flags from GtkWidget.
*/
#define GTK_PRIVATE_FLAGS(wid) (GTK_WIDGET (wid)->private_flags)
-#define GTK_WIDGET_USER_STYLE(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_USER_STYLE)
-#define GTK_WIDGET_REDRAW_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_REDRAW_PENDING)
-#define GTK_CONTAINER_RESIZE_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_PENDING)
-#define GTK_WIDGET_RESIZE_NEEDED(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_NEEDED)
-#define GTK_WIDGET_LEAVE_PENDING(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_LEAVE_PENDING)
-#define GTK_WIDGET_HAS_SHAPE_MASK(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_HAS_SHAPE_MASK)
-#define GTK_WIDGET_IN_REPARENT(obj) (GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_IN_REPARENT)
+#define GTK_WIDGET_USER_STYLE(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_USER_STYLE) != 0)
+#define GTK_WIDGET_REDRAW_PENDING(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_REDRAW_PENDING) != 0)
+#define GTK_CONTAINER_RESIZE_PENDING(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_PENDING) != 0)
+#define GTK_WIDGET_RESIZE_NEEDED(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_RESIZE_NEEDED) != 0)
+#define GTK_WIDGET_LEAVE_PENDING(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_LEAVE_PENDING) != 0)
+#define GTK_WIDGET_HAS_SHAPE_MASK(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_HAS_SHAPE_MASK) != 0)
+#define GTK_WIDGET_IN_REPARENT(obj) ((GTK_PRIVATE_FLAGS (obj) & PRIVATE_GTK_IN_REPARENT) != 0)
/* Macros for setting and clearing private widget flags.
* we use a preprocessor string concatenation here for a clear
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index f69c7f70e5..3e7512582c 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -493,14 +493,14 @@ gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
allocation->x = GTK_CONTAINER (widget)->border_width;
allocation->y = GTK_CONTAINER (widget)->border_width;
- allocation->width = MAX (0, widget->allocation.width - allocation->x * 2);
- allocation->height = MAX (0, widget->allocation.height - allocation->y * 2);
+ allocation->width = MAX (1, widget->allocation.width - allocation->x * 2);
+ allocation->height = MAX (1, widget->allocation.height - allocation->y * 2);
if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
- allocation->width = MAX (0,
+ allocation->width = MAX (1,
allocation->width - (scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING (scrolled_window)));
if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
- allocation->height = MAX (0,
+ allocation->height = MAX (1,
allocation->height - (scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING (scrolled_window)));
}
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index bb19e1be7a..6bf1bedd82 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -977,7 +977,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
for (col = 0; col < table->ncols; col++)
{
extra = width / (table->ncols - col);
- table->cols[col].allocation = MAX (0, extra);
+ table->cols[col].allocation = MAX (1, extra);
width -= extra;
}
}
@@ -1026,7 +1026,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->cols[col].shrink)
{
extra = width / nshrink;
- table->cols[col].allocation = MAX (0, table->cols[col].allocation - extra);
+ table->cols[col].allocation = MAX (1, table->cols[col].allocation - extra);
width -= extra;
nshrink -= 1;
@@ -1055,7 +1055,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
for (row = 0; row < table->nrows; row++)
{
extra = height / (table->nrows - row);
- table->rows[row].allocation = MAX (0, extra);
+ table->rows[row].allocation = MAX (1, extra);
height -= extra;
}
}
@@ -1104,7 +1104,7 @@ gtk_table_size_allocate_pass1 (GtkTable *table)
if (table->rows[row].shrink)
{
extra = height / nshrink;
- table->rows[row].allocation = MAX (0, table->rows[row].allocation - extra);
+ table->rows[row].allocation = MAX (1, table->rows[row].allocation - extra);
height -= extra;
nshrink -= 1;
@@ -1165,7 +1165,7 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
if (child->xfill)
{
- allocation.width = MAX (0, max_width - child->xpadding * 2);
+ allocation.width = MAX (1, max_width - child->xpadding * 2);
allocation.x = x + (max_width - allocation.width) / 2;
}
else
@@ -1176,7 +1176,7 @@ gtk_table_size_allocate_pass2 (GtkTable *table)
if (child->yfill)
{
- allocation.height = MAX (0, max_height - child->ypadding * 2);
+ allocation.height = MAX (1, max_height - child->ypadding * 2);
allocation.y = y + (max_height - allocation.height) / 2;
}
else
diff --git a/gtk/gtktree.c b/gtk/gtktree.c
index 8b35c554dc..0fe78be4c6 100644
--- a/gtk/gtktree.c
+++ b/gtk/gtktree.c
@@ -928,7 +928,7 @@ gtk_tree_size_allocate (GtkWidget *widget,
{
child_allocation.x = GTK_CONTAINER (tree)->border_width;
child_allocation.y = GTK_CONTAINER (tree)->border_width;
- child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2);
+ child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2);
children = tree->children;
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index daf4e85e69..9e84679afa 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -551,11 +551,11 @@ gtk_tree_item_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (item->pixmaps_box, &child_allocation);
child_allocation.y = GTK_CONTAINER (widget)->border_width;
- child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2);
+ child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2);
child_allocation.x += item->pixmaps_box->requisition.width+DEFAULT_DELTA;
child_allocation.width =
- MAX (0, allocation->width - (child_allocation.x + border_width));
+ MAX (1, allocation->width - (child_allocation.x + border_width));
gtk_widget_size_allocate (bin->child, &child_allocation);
}
diff --git a/gtk/gtkvbox.c b/gtk/gtkvbox.c
index 46993902dd..8398af0574 100644
--- a/gtk/gtkvbox.c
+++ b/gtk/gtkvbox.c
@@ -198,7 +198,7 @@ gtk_vbox_size_allocate (GtkWidget *widget,
y = allocation->y + GTK_CONTAINER (box)->border_width;
child_allocation.x = allocation->x + GTK_CONTAINER (box)->border_width;
- child_allocation.width = MAX (0, allocation->width - GTK_CONTAINER (box)->border_width * 2);
+ child_allocation.width = MAX (1, allocation->width - GTK_CONTAINER (box)->border_width * 2);
children = box->children;
while (children)
@@ -236,7 +236,7 @@ gtk_vbox_size_allocate (GtkWidget *widget,
if (child->fill)
{
- child_allocation.height = MAX (0, child_height - child->padding * 2);
+ child_allocation.height = MAX (1, child_height - child->padding * 2);
child_allocation.y = y + child->padding;
}
else
@@ -289,7 +289,7 @@ gtk_vbox_size_allocate (GtkWidget *widget,
if (child->fill)
{
- child_allocation.height = MAX (0, child_height - child->padding * 2);
+ child_allocation.height = MAX (1, child_height - child->padding * 2);
child_allocation.y = y + child->padding - child_height;
}
else
diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c
index a139267667..047b264e56 100644
--- a/gtk/gtkviewport.c
+++ b/gtk/gtkviewport.c
@@ -535,8 +535,8 @@ gtk_viewport_size_allocate (GtkWidget *widget,
child_allocation.y = GTK_WIDGET (viewport)->style->klass->ythickness;
}
- child_allocation.width = MAX (0, allocation->width - child_allocation.x * 2 - border_width * 2);
- child_allocation.height = MAX (0, allocation->height - child_allocation.y * 2 - border_width * 2);
+ child_allocation.width = MAX (1, allocation->width - child_allocation.x * 2 - border_width * 2);
+ child_allocation.height = MAX (1, allocation->height - child_allocation.y * 2 - border_width * 2);
if (GTK_WIDGET_REALIZED (widget))
{
diff --git a/gtk/gtkvpaned.c b/gtk/gtkvpaned.c
index 9828324d22..e59f4582e7 100644
--- a/gtk/gtkvpaned.c
+++ b/gtk/gtkvpaned.c
@@ -177,7 +177,7 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.height);
}
- child1_allocation.width = child2_allocation.width = MAX (0, allocation->width - border_width * 2);
+ child1_allocation.width = child2_allocation.width = MAX (1, allocation->width - border_width * 2);
child1_allocation.height = paned->child1_size;
child1_allocation.x = child2_allocation.x = border_width;
child1_allocation.y = border_width;
@@ -189,7 +189,7 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
paned->groove_rectangle.width = allocation->width;
child2_allocation.y = paned->groove_rectangle.y + paned->gutter_size / 2 + 1;
- child2_allocation.height = MAX (0, allocation->height
+ child2_allocation.height = MAX (1, allocation->height
- child2_allocation.y - border_width);
/* Now allocate the childen, making sure, when resizing not to
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 438696d267..bc380ec062 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -70,23 +70,23 @@ enum
/* Macros for extracting the widget flags from GtkWidget.
*/
#define GTK_WIDGET_FLAGS(wid) (GTK_OBJECT_FLAGS (wid))
-#define GTK_WIDGET_TOPLEVEL(wid) (GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL)
-#define GTK_WIDGET_NO_WINDOW(wid) (GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW)
-#define GTK_WIDGET_REALIZED(wid) (GTK_WIDGET_FLAGS (wid) & GTK_REALIZED)
-#define GTK_WIDGET_MAPPED(wid) (GTK_WIDGET_FLAGS (wid) & GTK_MAPPED)
-#define GTK_WIDGET_VISIBLE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE)
-#define GTK_WIDGET_DRAWABLE(wid) (GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid))
-#define GTK_WIDGET_SENSITIVE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE)
-#define GTK_WIDGET_PARENT_SENSITIVE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE)
-#define GTK_WIDGET_IS_SENSITIVE(wid) ((GTK_WIDGET_SENSITIVE (wid) && \
- GTK_WIDGET_PARENT_SENSITIVE (wid)) != 0)
-#define GTK_WIDGET_CAN_FOCUS(wid) (GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS)
-#define GTK_WIDGET_HAS_FOCUS(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS)
-#define GTK_WIDGET_CAN_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT)
-#define GTK_WIDGET_HAS_DEFAULT(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT)
-#define GTK_WIDGET_HAS_GRAB(wid) (GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB)
-#define GTK_WIDGET_BASIC(wid) (GTK_WIDGET_FLAGS (wid) & GTK_BASIC)
-#define GTK_WIDGET_RC_STYLE(wid) (GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE)
+#define GTK_WIDGET_TOPLEVEL(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_TOPLEVEL) != 0)
+#define GTK_WIDGET_NO_WINDOW(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_NO_WINDOW) != 0)
+#define GTK_WIDGET_REALIZED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_REALIZED) != 0)
+#define GTK_WIDGET_MAPPED(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_MAPPED) != 0)
+#define GTK_WIDGET_VISIBLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_VISIBLE) != 0)
+#define GTK_WIDGET_DRAWABLE(wid) ((GTK_WIDGET_VISIBLE (wid) && GTK_WIDGET_MAPPED (wid)) != 0)
+#define GTK_WIDGET_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_SENSITIVE) != 0)
+#define GTK_WIDGET_PARENT_SENSITIVE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_PARENT_SENSITIVE) != 0)
+#define GTK_WIDGET_IS_SENSITIVE(wid) (((GTK_WIDGET_SENSITIVE (wid) && \
+ GTK_WIDGET_PARENT_SENSITIVE (wid)) != 0) != 0)
+#define GTK_WIDGET_CAN_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_FOCUS) != 0)
+#define GTK_WIDGET_HAS_FOCUS(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_FOCUS) != 0)
+#define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
+#define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
+#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
+#define GTK_WIDGET_BASIC(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_BASIC) != 0)
+#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
/* Macros for setting and clearing widget flags.
*/
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 502cc3cdf2..a177fe0acf 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -1283,6 +1283,7 @@ gtk_window_set_hints (GtkWidget *widget,
GtkWidgetAuxInfo *aux_info;
gint flags;
gint ux, uy;
+ gint min_width, min_height;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_WINDOW (widget));
@@ -1303,6 +1304,7 @@ gtk_window_set_hints (GtkWidget *widget,
uy = aux_info->y;
flags |= GDK_HINT_POS;
}
+
if (!window->allow_shrink)
flags |= GDK_HINT_MIN_SIZE;
if (!window->allow_grow)