diff options
author | Owen Taylor <otaylor@gtk.org> | 1998-06-19 01:26:24 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 1998-06-19 01:26:24 +0000 |
commit | 913831b26f3b4b0a69dce8574017a78828e93b83 (patch) | |
tree | 6454867cb387f24084917262261e1cdd7c4dcf89 | |
parent | 25bd56b9957d930a2edd573d52ef389493a224ae (diff) | |
download | gdk-pixbuf-913831b26f3b4b0a69dce8574017a78828e93b83.tar.gz |
Remove --g-fatal-warnings flag from argv.
Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag
from argv.
Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org>
* gtk/genmarshal.pl: Modified to be more idiomatic Perl,
to be more readable perl, to spit out stuff that looks
more like readable C, and to pipe output through indent
so output looks a lot like readable C. No functional
changes.
Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if
necessary when switching to a masked pixmap. (Based on a patch
from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>)
Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkeditable.[ch]: Added action signals for keyboard
bindings. (move_cursor, kill_word, etc, etc, etc).
removed the time argument from
gtk_editable_cut/copy/paste_clipboard (source but not
binary incompatible...) Instead get time from
gtk_get_current_event ().
* gtk/gtktext.c gtk/gtkentry.c: Support the new editable
signals.
Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org>
Patches from Damon Chaplin <DAChaplin@email.msn.com>:
gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change
parent class to GtkNotebookClass when splitting the widget in
two. Also updated some comments.
gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps'
button without a font selected.
Fixed bug in set_font_name - I hadn't updated the code to
search for the style in the font_style clist - it was
still assuming the style row was equal to its index,
but it isn't any more.
Changed 'Reset' button on filter page to 'Clear Filter'.
Deleted old code relating to the old 'Filter Fonts' toggle
Updated some comments.
Cleared 'Actual Fontname' if no font is set.
gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was
destroying the GtkFontSelection instead of the
GtkFontSelectionDialog.
Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings
flag to make all warnings fatal errors.
* gtk/testthreads.c: moved <pthreads.h> include inside
#ifdef USE_PTHREADS
Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c
gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c:
- Added new function gtk_container_set_resize_mode() for
fine-grained control of where resize-queueing is done.
- Removed GtkContainer::need_resize and GtkWindow::move_resize
- Added GtkContainer::check_resize to replace need_resize.
- Added function gtk_container_check_resize() to trigger
queued resizes, and gtk_container_resize_children() to
Figure which children need to be size-allocated. (logic
moved from gtkwindow.c)
- Reorganized code in gtkwindow.c
- Set the resize-mode for viewports so that resizes within
a viewport don't propagate out of it.
37 files changed, 1844 insertions, 772 deletions
@@ -1,3 +1,90 @@ +Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag + from argv. + +Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/genmarshal.pl: Modified to be more idiomatic Perl, + to be more readable perl, to spit out stuff that looks + more like readable C, and to pipe output through indent + so output looks a lot like readable C. No functional + changes. + +Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if + necessary when switching to a masked pixmap. (Based on a patch + from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>) + +Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkeditable.[ch]: Added action signals for keyboard + bindings. (move_cursor, kill_word, etc, etc, etc). + + removed the time argument from + gtk_editable_cut/copy/paste_clipboard (source but not + binary incompatible...) Instead get time from + gtk_get_current_event (). + + * gtk/gtktext.c gtk/gtkentry.c: Support the new editable + signals. + +Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org> + + Patches from Damon Chaplin <DAChaplin@email.msn.com>: + + gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change + parent class to GtkNotebookClass when splitting the widget in + two. Also updated some comments. + + gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps' + button without a font selected. + + Fixed bug in set_font_name - I hadn't updated the code to + search for the style in the font_style clist - it was + still assuming the style row was equal to its index, + but it isn't any more. + + Changed 'Reset' button on filter page to 'Clear Filter'. + Deleted old code relating to the old 'Filter Fonts' toggle + Updated some comments. + Cleared 'Actual Fontname' if no font is set. + + gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was + destroying the GtkFontSelection instead of the + GtkFontSelectionDialog. + +Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings + flag to make all warnings fatal errors. + + * gtk/testthreads.c: moved <pthreads.h> include inside + #ifdef USE_PTHREADS + +Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c + gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c: + + - Added new function gtk_container_set_resize_mode() for + fine-grained control of where resize-queueing is done. + + - Removed GtkContainer::need_resize and GtkWindow::move_resize + - Added GtkContainer::check_resize to replace need_resize. + + - Added function gtk_container_check_resize() to trigger + queued resizes, and gtk_container_resize_children() to + Figure which children need to be size-allocated. (logic + moved from gtkwindow.c) + + - Reorganized code in gtkwindow.c + + - Set the resize-mode for viewports so that resizes within + a viewport don't propagate out of it. + + 1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx> * gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings. @@ -159,7 +246,7 @@ Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org> Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org> - * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font + * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font lists from the klass structure to a static structure in gtkfontsel.c; cleans up global the namespace. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 56ac4d6b3..0b8e8cb93 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,90 @@ +Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag + from argv. + +Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/genmarshal.pl: Modified to be more idiomatic Perl, + to be more readable perl, to spit out stuff that looks + more like readable C, and to pipe output through indent + so output looks a lot like readable C. No functional + changes. + +Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if + necessary when switching to a masked pixmap. (Based on a patch + from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>) + +Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkeditable.[ch]: Added action signals for keyboard + bindings. (move_cursor, kill_word, etc, etc, etc). + + removed the time argument from + gtk_editable_cut/copy/paste_clipboard (source but not + binary incompatible...) Instead get time from + gtk_get_current_event (). + + * gtk/gtktext.c gtk/gtkentry.c: Support the new editable + signals. + +Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org> + + Patches from Damon Chaplin <DAChaplin@email.msn.com>: + + gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change + parent class to GtkNotebookClass when splitting the widget in + two. Also updated some comments. + + gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps' + button without a font selected. + + Fixed bug in set_font_name - I hadn't updated the code to + search for the style in the font_style clist - it was + still assuming the style row was equal to its index, + but it isn't any more. + + Changed 'Reset' button on filter page to 'Clear Filter'. + Deleted old code relating to the old 'Filter Fonts' toggle + Updated some comments. + Cleared 'Actual Fontname' if no font is set. + + gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was + destroying the GtkFontSelection instead of the + GtkFontSelectionDialog. + +Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings + flag to make all warnings fatal errors. + + * gtk/testthreads.c: moved <pthreads.h> include inside + #ifdef USE_PTHREADS + +Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c + gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c: + + - Added new function gtk_container_set_resize_mode() for + fine-grained control of where resize-queueing is done. + + - Removed GtkContainer::need_resize and GtkWindow::move_resize + - Added GtkContainer::check_resize to replace need_resize. + + - Added function gtk_container_check_resize() to trigger + queued resizes, and gtk_container_resize_children() to + Figure which children need to be size-allocated. (logic + moved from gtkwindow.c) + + - Reorganized code in gtkwindow.c + + - Set the resize-mode for viewports so that resizes within + a viewport don't propagate out of it. + + 1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx> * gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings. @@ -159,7 +246,7 @@ Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org> Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org> - * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font + * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font lists from the klass structure to a static structure in gtkfontsel.c; cleans up global the namespace. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 56ac4d6b3..0b8e8cb93 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,90 @@ +Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag + from argv. + +Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/genmarshal.pl: Modified to be more idiomatic Perl, + to be more readable perl, to spit out stuff that looks + more like readable C, and to pipe output through indent + so output looks a lot like readable C. No functional + changes. + +Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if + necessary when switching to a masked pixmap. (Based on a patch + from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>) + +Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkeditable.[ch]: Added action signals for keyboard + bindings. (move_cursor, kill_word, etc, etc, etc). + + removed the time argument from + gtk_editable_cut/copy/paste_clipboard (source but not + binary incompatible...) Instead get time from + gtk_get_current_event (). + + * gtk/gtktext.c gtk/gtkentry.c: Support the new editable + signals. + +Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org> + + Patches from Damon Chaplin <DAChaplin@email.msn.com>: + + gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change + parent class to GtkNotebookClass when splitting the widget in + two. Also updated some comments. + + gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps' + button without a font selected. + + Fixed bug in set_font_name - I hadn't updated the code to + search for the style in the font_style clist - it was + still assuming the style row was equal to its index, + but it isn't any more. + + Changed 'Reset' button on filter page to 'Clear Filter'. + Deleted old code relating to the old 'Filter Fonts' toggle + Updated some comments. + Cleared 'Actual Fontname' if no font is set. + + gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was + destroying the GtkFontSelection instead of the + GtkFontSelectionDialog. + +Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings + flag to make all warnings fatal errors. + + * gtk/testthreads.c: moved <pthreads.h> include inside + #ifdef USE_PTHREADS + +Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c + gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c: + + - Added new function gtk_container_set_resize_mode() for + fine-grained control of where resize-queueing is done. + + - Removed GtkContainer::need_resize and GtkWindow::move_resize + - Added GtkContainer::check_resize to replace need_resize. + + - Added function gtk_container_check_resize() to trigger + queued resizes, and gtk_container_resize_children() to + Figure which children need to be size-allocated. (logic + moved from gtkwindow.c) + + - Reorganized code in gtkwindow.c + + - Set the resize-mode for viewports so that resizes within + a viewport don't propagate out of it. + + 1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx> * gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings. @@ -159,7 +246,7 @@ Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org> Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org> - * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font + * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font lists from the klass structure to a static structure in gtkfontsel.c; cleans up global the namespace. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 56ac4d6b3..0b8e8cb93 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,90 @@ +Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag + from argv. + +Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/genmarshal.pl: Modified to be more idiomatic Perl, + to be more readable perl, to spit out stuff that looks + more like readable C, and to pipe output through indent + so output looks a lot like readable C. No functional + changes. + +Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if + necessary when switching to a masked pixmap. (Based on a patch + from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>) + +Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkeditable.[ch]: Added action signals for keyboard + bindings. (move_cursor, kill_word, etc, etc, etc). + + removed the time argument from + gtk_editable_cut/copy/paste_clipboard (source but not + binary incompatible...) Instead get time from + gtk_get_current_event (). + + * gtk/gtktext.c gtk/gtkentry.c: Support the new editable + signals. + +Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org> + + Patches from Damon Chaplin <DAChaplin@email.msn.com>: + + gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change + parent class to GtkNotebookClass when splitting the widget in + two. Also updated some comments. + + gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps' + button without a font selected. + + Fixed bug in set_font_name - I hadn't updated the code to + search for the style in the font_style clist - it was + still assuming the style row was equal to its index, + but it isn't any more. + + Changed 'Reset' button on filter page to 'Clear Filter'. + Deleted old code relating to the old 'Filter Fonts' toggle + Updated some comments. + Cleared 'Actual Fontname' if no font is set. + + gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was + destroying the GtkFontSelection instead of the + GtkFontSelectionDialog. + +Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings + flag to make all warnings fatal errors. + + * gtk/testthreads.c: moved <pthreads.h> include inside + #ifdef USE_PTHREADS + +Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c + gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c: + + - Added new function gtk_container_set_resize_mode() for + fine-grained control of where resize-queueing is done. + + - Removed GtkContainer::need_resize and GtkWindow::move_resize + - Added GtkContainer::check_resize to replace need_resize. + + - Added function gtk_container_check_resize() to trigger + queued resizes, and gtk_container_resize_children() to + Figure which children need to be size-allocated. (logic + moved from gtkwindow.c) + + - Reorganized code in gtkwindow.c + + - Set the resize-mode for viewports so that resizes within + a viewport don't propagate out of it. + + 1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx> * gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings. @@ -159,7 +246,7 @@ Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org> Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org> - * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font + * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font lists from the klass structure to a static structure in gtkfontsel.c; cleans up global the namespace. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 56ac4d6b3..0b8e8cb93 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,90 @@ +Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag + from argv. + +Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/genmarshal.pl: Modified to be more idiomatic Perl, + to be more readable perl, to spit out stuff that looks + more like readable C, and to pipe output through indent + so output looks a lot like readable C. No functional + changes. + +Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if + necessary when switching to a masked pixmap. (Based on a patch + from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>) + +Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkeditable.[ch]: Added action signals for keyboard + bindings. (move_cursor, kill_word, etc, etc, etc). + + removed the time argument from + gtk_editable_cut/copy/paste_clipboard (source but not + binary incompatible...) Instead get time from + gtk_get_current_event (). + + * gtk/gtktext.c gtk/gtkentry.c: Support the new editable + signals. + +Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org> + + Patches from Damon Chaplin <DAChaplin@email.msn.com>: + + gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change + parent class to GtkNotebookClass when splitting the widget in + two. Also updated some comments. + + gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps' + button without a font selected. + + Fixed bug in set_font_name - I hadn't updated the code to + search for the style in the font_style clist - it was + still assuming the style row was equal to its index, + but it isn't any more. + + Changed 'Reset' button on filter page to 'Clear Filter'. + Deleted old code relating to the old 'Filter Fonts' toggle + Updated some comments. + Cleared 'Actual Fontname' if no font is set. + + gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was + destroying the GtkFontSelection instead of the + GtkFontSelectionDialog. + +Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings + flag to make all warnings fatal errors. + + * gtk/testthreads.c: moved <pthreads.h> include inside + #ifdef USE_PTHREADS + +Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c + gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c: + + - Added new function gtk_container_set_resize_mode() for + fine-grained control of where resize-queueing is done. + + - Removed GtkContainer::need_resize and GtkWindow::move_resize + - Added GtkContainer::check_resize to replace need_resize. + + - Added function gtk_container_check_resize() to trigger + queued resizes, and gtk_container_resize_children() to + Figure which children need to be size-allocated. (logic + moved from gtkwindow.c) + + - Reorganized code in gtkwindow.c + + - Set the resize-mode for viewports so that resizes within + a viewport don't propagate out of it. + + 1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx> * gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings. @@ -159,7 +246,7 @@ Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org> Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org> - * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font + * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font lists from the klass structure to a static structure in gtkfontsel.c; cleans up global the namespace. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 56ac4d6b3..0b8e8cb93 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,90 @@ +Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag + from argv. + +Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/genmarshal.pl: Modified to be more idiomatic Perl, + to be more readable perl, to spit out stuff that looks + more like readable C, and to pipe output through indent + so output looks a lot like readable C. No functional + changes. + +Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if + necessary when switching to a masked pixmap. (Based on a patch + from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>) + +Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkeditable.[ch]: Added action signals for keyboard + bindings. (move_cursor, kill_word, etc, etc, etc). + + removed the time argument from + gtk_editable_cut/copy/paste_clipboard (source but not + binary incompatible...) Instead get time from + gtk_get_current_event (). + + * gtk/gtktext.c gtk/gtkentry.c: Support the new editable + signals. + +Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org> + + Patches from Damon Chaplin <DAChaplin@email.msn.com>: + + gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change + parent class to GtkNotebookClass when splitting the widget in + two. Also updated some comments. + + gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps' + button without a font selected. + + Fixed bug in set_font_name - I hadn't updated the code to + search for the style in the font_style clist - it was + still assuming the style row was equal to its index, + but it isn't any more. + + Changed 'Reset' button on filter page to 'Clear Filter'. + Deleted old code relating to the old 'Filter Fonts' toggle + Updated some comments. + Cleared 'Actual Fontname' if no font is set. + + gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was + destroying the GtkFontSelection instead of the + GtkFontSelectionDialog. + +Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings + flag to make all warnings fatal errors. + + * gtk/testthreads.c: moved <pthreads.h> include inside + #ifdef USE_PTHREADS + +Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c + gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c: + + - Added new function gtk_container_set_resize_mode() for + fine-grained control of where resize-queueing is done. + + - Removed GtkContainer::need_resize and GtkWindow::move_resize + - Added GtkContainer::check_resize to replace need_resize. + + - Added function gtk_container_check_resize() to trigger + queued resizes, and gtk_container_resize_children() to + Figure which children need to be size-allocated. (logic + moved from gtkwindow.c) + + - Reorganized code in gtkwindow.c + + - Set the resize-mode for viewports so that resizes within + a viewport don't propagate out of it. + + 1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx> * gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings. @@ -159,7 +246,7 @@ Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org> Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org> - * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font + * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font lists from the klass structure to a static structure in gtkfontsel.c; cleans up global the namespace. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 56ac4d6b3..0b8e8cb93 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,90 @@ +Thu Jun 18 21:13:54 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Remove --g-fatal-warnings flag + from argv. + +Thu Jun 18 20:22:28 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/genmarshal.pl: Modified to be more idiomatic Perl, + to be more readable perl, to spit out stuff that looks + more like readable C, and to pipe output through indent + so output looks a lot like readable C. No functional + changes. + +Thu Jun 18 17:43:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkpixmap.[ch] (gtk_pixmap_set): Clear the background if + necessary when switching to a masked pixmap. (Based on a patch + from Ullrich Hafner <hafner@informatik.uni-wuerzburg.de>) + +Thu Jun 18 16:18:10 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkeditable.[ch]: Added action signals for keyboard + bindings. (move_cursor, kill_word, etc, etc, etc). + + removed the time argument from + gtk_editable_cut/copy/paste_clipboard (source but not + binary incompatible...) Instead get time from + gtk_get_current_event (). + + * gtk/gtktext.c gtk/gtkentry.c: Support the new editable + signals. + +Thu Jun 18 02:52:09 1998 Owen Taylor <otaylor@gtk.org> + + Patches from Damon Chaplin <DAChaplin@email.msn.com>: + + gtk/gtkfontsel.h: Fixed GtkFontSelectionClass - I forgot to change + parent class to GtkNotebookClass when splitting the widget in + two. Also updated some comments. + + gtk/gtkfontsel.c: Fixed bug when toggling 'Allow scaled bitmaps' + button without a font selected. + + Fixed bug in set_font_name - I hadn't updated the code to + search for the style in the font_style clist - it was + still assuming the style row was equal to its index, + but it isn't any more. + + Changed 'Reset' button on filter page to 'Clear Filter'. + Deleted old code relating to the old 'Filter Fonts' toggle + Updated some comments. + Cleared 'Actual Fontname' if no font is set. + + gtk/testgtk.c: Fixed problem when 'OK' button is pressed - it was + destroying the GtkFontSelection instead of the + GtkFontSelectionDialog. + +Thu Jun 18 02:15:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkmain.c (gtk_init): Added --g-fatal-warnings + flag to make all warnings fatal errors. + + * gtk/testthreads.c: moved <pthreads.h> include inside + #ifdef USE_PTHREADS + +Thu Jun 18 01:37:31 1998 Owen Taylor <otaylor@gtk.org> + + * gtk/gtkenums.h gtk/gtkcontainer.[ch] gtk/gtkwidget.c + gtk/gtkmenu.c gtk/gtkviewport.c gtk/gtkwindow.c: + + - Added new function gtk_container_set_resize_mode() for + fine-grained control of where resize-queueing is done. + + - Removed GtkContainer::need_resize and GtkWindow::move_resize + - Added GtkContainer::check_resize to replace need_resize. + + - Added function gtk_container_check_resize() to trigger + queued resizes, and gtk_container_resize_children() to + Figure which children need to be size-allocated. (logic + moved from gtkwindow.c) + + - Reorganized code in gtkwindow.c + + - Set the resize-mode for viewports so that resizes within + a viewport don't propagate out of it. + + 1998-06-18 Federico Mena Quintero <federico@nuclecu.unam.mx> * gtk/gtkfontsel.c: Use pointer<->int conversion macros to avoid warnings. @@ -159,7 +246,7 @@ Fri Jun 12 16:33:23 1998 Tim Janik <timj@gtk.org> Mon Jun 15 23:39:44 1998 Owen Taylor <otaylor@gtk.org> - * gtk/gtkfontsel.c (gtk_font_selection_dialog_init): Moved font + * gtk/gtkfontsel.[ch] (gtk_font_selection_dialog_init): Moved font lists from the klass structure to a static structure in gtkfontsel.c; cleans up global the namespace. diff --git a/gtk/genmarshal.pl b/gtk/genmarshal.pl index 033f9b251..d85d9b798 100755 --- a/gtk/genmarshal.pl +++ b/gtk/genmarshal.pl @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/perl -w # # by Elliot Lee <sopwith@redhat.com> @@ -14,68 +14,95 @@ "C_CALLBACK"=>"gpointer"); open(IL, "<".$ENV{'srcdir'}."/gtkmarshal.list") || die("Open failed: $!"); -open(OH, ">gtkmarshal.h") || die("Open failed: $!"); -open(OS, ">gtkmarshal.c") || die("Open failed: $!"); +open(OH, "|indent > gtkmarshal.h") || die("Open failed: $!"); +open(OS, "|indent > gtkmarshal.c") || die("Open failed: $!"); -print OH "#ifndef __GTKMARSHAL_H__\n#define __GTKMARSHAL_H__ 1\n\n"; -print OH "#include \"gtktypeutils.h\"\n#include \"gtkobject.h\"\n"; +print OH <<EOT; +#ifndef __GTKMARSHAL_H__ +#define __GTKMARSHAL_H__ 1 -print OS "#include \"gtkmarshal.h\"\n"; +#include "gtktypeutils.h" +#include "gtkobject.h" + +EOT + +print OS qq(#include "gtkmarshal.h"\n\n); while(chomp($aline = <IL>)) { ($retval, $paramlist) = split(/:/, $aline, 2); @params = split(/\s*,\s*/, $paramlist); - if($defs{$retval."__".join("_",@params)} == 1) { next; } + my $funcname = $retval."__".join("_",@params); + + next if (exists $defs{$funcname}); $doequiv = 0; - foreach(@params) { if($trans{$_} eq "gpointer") { $doequiv = 1; } } + for (@params, $retval) { + if ($trans{$_} eq "gpointer") { + $doequiv = 1; + last; + } + } + # Translate all function pointers to gpointer $defname = ""; if($doequiv) { - $defname = $retval."__".join("_",@params); - print OH "#define gtk_marshal_".$retval."__".join("_",@params)." "; - - for($i = 0; $i < scalar @params; $i++) - { if($trans{$params[$i]} eq "gpointer") { $params[$i] = "POINTER"; } } - if($trans{$retval} eq "gpointer") { $retval = "POINTER"; } - print OH "gtk_marshal_".$retval."__".join("_",@params)."\n"; - - $regname = $retval."__".join("_",@params); - if($defs{$regname} == 1) { next; } - $defs{$defname} = 1; + print OH "#define gtk_marshal_$funcname "; + $defs{$defname} = 1; + + for (@params, $retval) { + if ($trans{$_} eq "gpointer") { + $_ = "POINTER"; + } + } + + $funcname = $retval."__".join("_",@params); + + print OH "gtk_marshal_$funcname\n"; + next if (exists $defs{$funcname}); } + $defs{$funcname} = 1; - $defs{$retval."__".join("_",@params)} = 1; - - print OH "void gtk_marshal_".$retval."__".join("_",@params)."(GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args);\n"; - - print OS "typedef ".$trans{$retval}. " (*GtkSignal_" - .$retval."__".join("_",@params).")(GtkObject *object, "; + print OH <<EOT; +void gtk_marshal_$funcname (GtkObject *object, + GtkSignalFunc func, + gpointer func_data, + GtkArg *args); +EOT + + print OS "typedef $trans{$retval} (*GtkSignal_$funcname) (GtkObject *object, \n"; $argn = 1; - foreach $it(@params) { if($it ne "NONE") {print OS $trans{$it}." arg".$argn++.",\n"; } } + for (@params) { + print OS "$trans{$_} arg".$argn++.",\n" unless $_ eq "NONE"; + } print OS "gpointer user_data);\n"; - print OS "void gtk_marshal_".$retval."__".join("_",@params)."(GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args)\n"; + print OS <<EOT; +void gtk_marshal_$funcname (GtkObject *object, + GtkSignalFunc func, + gpointer func_data, + GtkArg *args) +{ + GtkSignal_$funcname rfunc; +EOT - print OS "{\nGtkSignal_".$retval."__".join("_",@params)." rfunc;\n"; if($retval ne "NONE") { - print OS $trans{$retval}." *return_val;\n"; - - print OS "return_val = GTK_RETLOC_".$retval."(args[".(scalar @params)."]);\n"; + print OS " $trans{$retval} *return_val;\n"; + print OS " return_val = GTK_RETLOC_$retval (args[".(scalar @params)."]);\n"; } - print OS "rfunc = (GtkSignal_".$retval."__".join("_",@params).") func;\n"; + print OS " rfunc = (GtkSignal_$funcname) func;\n"; + print OS " *return_val = " unless $retval eq "NONE"; + print OS " (* rfunc) (object,\n"; - if($retval ne "NONE") { print OS "*return_val = "; } - - print OS "(* rfunc)(object, "; for($i = 0; $i < (scalar @params); $i++) { - ($params[$i] eq "NONE") && next; - print OS "GTK_VALUE_".$params[$i]."(args[$i]), "; + if ($params[$i] ne "NONE") { + print OS " GTK_VALUE_$params[$i](args[$i]),\n"; + } } - print OS "func_data);\n}\n\n"; + print OS " func_data);\n}\n\n"; } print OH "#endif\n"; + close(IL); close(OH); close(OS); diff --git a/gtk/gtk.defs b/gtk/gtk.defs index df970658a..4b2a3fef1 100644 --- a/gtk/gtk.defs +++ b/gtk/gtk.defs @@ -1,7 +1,7 @@ ;; generated by makeenums.pl ; -*- scheme -*- -; enumerations from "./gtkclist.h" +; enumerations from "../../gtk+/gtk/gtkclist.h" (define-enum GtkCellType (empty GTK_CELL_EMPTY) @@ -10,7 +10,7 @@ (pixtext GTK_CELL_PIXTEXT) (widget GTK_CELL_WIDGET)) -; enumerations from "./gtkctree.h" +; enumerations from "../../gtk+/gtk/gtkctree.h" (define-enum GtkCTreePos (before GTK_CTREE_POS_BEFORE) @@ -22,14 +22,14 @@ (dotted GTK_CTREE_LINES_DOTTED) (none GTK_CTREE_LINES_NONE)) -; enumerations from "./gtkdebug.h" +; enumerations from "../../gtk+/gtk/gtkdebug.h" (define-flags GtkDebugFlag (objects GTK_DEBUG_OBJECTS) (misc GTK_DEBUG_MISC) (signals GTK_DEBUG_SIGNALS)) -; enumerations from "./gtkenums.h" +; enumerations from "../../gtk+/gtk/gtkenums.h" (define-flags GtkAccelFlags (visible GTK_ACCEL_VISIBLE) @@ -131,6 +131,11 @@ (normal GTK_RELIEF_NORMAL) (none GTK_RELIEF_NONE)) +(define-enum GtkResizeMode + (parent GTK_RESIZE_PARENT) + (queue GTK_RESIZE_QUEUE) + (immediate GTK_RESIZE_IMMEDIATE)) + (define-flags GtkSignalRunType (first GTK_RUN_FIRST) (last GTK_RUN_LAST) @@ -206,13 +211,13 @@ (dialog GTK_WINDOW_DIALOG) (popup GTK_WINDOW_POPUP)) -; enumerations from "./gtkfontsel.h" +; enumerations from "../../gtk+/gtk/gtkfontsel.h" (define-enum GtkFontMetricType (ixels-metric PIXELS_METRIC) (oints-metric POINTS_METRIC)) -; enumerations from "./gtkobject.h" +; enumerations from "../../gtk+/gtk/gtkobject.h" (define-flags GtkObjectFlags (destroyed GTK_DESTROYED) @@ -229,7 +234,7 @@ (mask GTK_ARG_MASK) (readwrite GTK_ARG_READWRITE)) -; enumerations from "./gtkpacker.h" +; enumerations from "../../gtk+/gtk/gtkpacker.h" (define-flags GtkPackerOptions (expand GTK_PACK_EXPAND) @@ -261,7 +266,7 @@ (w GTK_ANCHOR_W) (e GTK_ANCHOR_E)) -; enumerations from "./gtkprivate.h" +; enumerations from "../../gtk+/gtk/gtkprivate.h" (define-flags GtkPrivateFlags (user-style PRIVATE_GTK_USER_STYLE) @@ -272,13 +277,13 @@ (has-shape-mask PRIVATE_GTK_HAS_SHAPE_MASK) (in-reparent PRIVATE_GTK_IN_REPARENT)) -; enumerations from "./gtkspinbutton.h" +; enumerations from "../../gtk+/gtk/gtkspinbutton.h" (define-enum GtkSpinButtonUpdatePolicy (always GTK_UPDATE_ALWAYS) (if-valid GTK_UPDATE_IF_VALID)) -; enumerations from "./gtktoolbar.h" +; enumerations from "../../gtk+/gtk/gtktoolbar.h" (define-enum GtkToolbarChildType (space GTK_TOOLBAR_CHILD_SPACE) @@ -287,13 +292,13 @@ (radiobutton GTK_TOOLBAR_CHILD_RADIOBUTTON) (widget GTK_TOOLBAR_CHILD_WIDGET)) -; enumerations from "./gtktree.h" +; enumerations from "../../gtk+/gtk/gtktree.h" (define-enum GtkTreeViewMode (line GTK_TREE_VIEW_LINE) (item GTK_TREE_VIEW_ITEM)) -; enumerations from "./gtktypeutils.h" +; enumerations from "../../gtk+/gtk/gtktypeutils.h" (define-enum GtkFundamentalType (invalid GTK_TYPE_INVALID) @@ -318,7 +323,7 @@ (c-callback GTK_TYPE_C_CALLBACK) (object GTK_TYPE_OBJECT)) -; enumerations from "./gtkwidget.h" +; enumerations from "../../gtk+/gtk/gtkwidget.h" (define-flags GtkWidgetFlags (toplevel GTK_TOPLEVEL) @@ -336,7 +341,7 @@ (rc-style GTK_RC_STYLE) (basic GTK_BASIC)) -; enumerations from "../gdk/gdkprivate.h" +; enumerations from "../../gtk+/gdk/gdkprivate.h" (define-flags GdkDebugFlag (misc GDK_DEBUG_MISC) @@ -345,7 +350,7 @@ (color-context GDK_DEBUG_COLOR_CONTEXT) (xim GDK_DEBUG_XIM)) -; enumerations from "../gdk/gdktypes.h" +; enumerations from "../../gtk+/gdk/gdktypes.h" (define-enum GdkWindowType (root GDK_WINDOW_ROOT) diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c index 198ea17b2..710907fa7 100644 --- a/gtk/gtkbutton.c +++ b/gtk/gtkbutton.c @@ -234,8 +234,6 @@ gtk_button_set_arg (GtkButton *button, switch (arg_id) { case ARG_LABEL: - gtk_container_disable_resize (GTK_CONTAINER (button)); - if (button->child) { gtk_widget_unparent (button->child); @@ -246,7 +244,6 @@ gtk_button_set_arg (GtkButton *button, gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (button), label); - gtk_container_enable_resize (GTK_CONTAINER (button)); break; default: break; diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 8b4db22d6..7b03cb639 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -26,7 +26,7 @@ enum { ADD, REMOVE, - NEED_RESIZE, + CHECK_RESIZE, FOREACH, FOCUS, SET_FOCUS_CHILD, @@ -35,8 +35,6 @@ enum { enum { ARG_0, ARG_BORDER_WIDTH, - ARG_AUTO_RESIZE, - ARG_BLOCK_RESIZE, ARG_CHILD }; @@ -78,10 +76,6 @@ static void gtk_container_marshal_signal_3 (GtkObject *object, GtkSignalFunc func, gpointer func_data, GtkArg *args); -static void gtk_container_marshal_signal_4 (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); static void gtk_container_class_init (GtkContainerClass *klass); @@ -97,7 +91,7 @@ static void gtk_container_add_unimplemented (GtkContainer *container, GtkWidget *widget); static void gtk_container_remove_unimplemented (GtkContainer *container, GtkWidget *widget); -static gint gtk_container_real_need_resize (GtkContainer *container); +static void gtk_container_real_check_resize (GtkContainer *container); static gint gtk_container_real_focus (GtkContainer *container, GtkDirectionType direction); static void gtk_container_real_set_focus_child (GtkContainer *container, @@ -174,8 +168,6 @@ gtk_container_class_init (GtkContainerClass *class) hadjustment_key_id = gtk_object_data_force_id (hadjustment_key); gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH); - gtk_object_add_arg_type ("GtkContainer::auto_resize", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_AUTO_RESIZE); - gtk_object_add_arg_type ("GtkContainer::block_resize", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_BLOCK_RESIZE); gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, GTK_ARG_WRITABLE, ARG_CHILD); container_signals[ADD] = @@ -194,13 +186,13 @@ gtk_container_class_init (GtkContainerClass *class) gtk_container_marshal_signal_1, GTK_TYPE_NONE, 1, GTK_TYPE_WIDGET); - container_signals[NEED_RESIZE] = - gtk_signal_new ("need_resize", + container_signals[CHECK_RESIZE] = + gtk_signal_new ("check_resize", GTK_RUN_LAST, object_class->type, - GTK_SIGNAL_OFFSET (GtkContainerClass, need_resize), - gtk_container_marshal_signal_4, - GTK_TYPE_BOOL, 0); + GTK_SIGNAL_OFFSET (GtkContainerClass, check_resize), + gtk_signal_default_marshaller, + GTK_TYPE_NONE, 0); container_signals[FOREACH] = gtk_signal_new ("foreach", GTK_RUN_FIRST, @@ -238,7 +230,7 @@ gtk_container_class_init (GtkContainerClass *class) class->add = gtk_container_add_unimplemented; class->remove = gtk_container_remove_unimplemented; - class->need_resize = gtk_container_real_need_resize; + class->check_resize = gtk_container_real_check_resize; class->foreach = NULL; class->focus = gtk_container_real_focus; class->set_focus_child = gtk_container_real_set_focus_child; @@ -671,31 +663,24 @@ gtk_container_init (GtkContainer *container) { container->focus_child = NULL; container->border_width = 0; - container->auto_resize = TRUE; container->need_resize = FALSE; - container->block_resize = FALSE; + container->resize_mode = GTK_RESIZE_PARENT; container->resize_widgets = NULL; } static void gtk_container_destroy (GtkObject *object) { - GSList *node; - + GtkContainer *container; + g_return_if_fail (object != NULL); g_return_if_fail (GTK_IS_CONTAINER (object)); - for (node = GTK_CONTAINER (object)->resize_widgets; node; node = node->next) - { - GtkWidget *child; - - child = (GtkWidget*) node->data; - GTK_PRIVATE_UNSET_FLAG (child, GTK_RESIZE_NEEDED); - } - g_slist_free (GTK_CONTAINER (object)->resize_widgets); - GTK_CONTAINER (object)->resize_widgets = NULL; + container = GTK_CONTAINER (object); - gtk_container_foreach (GTK_CONTAINER (object), + gtk_container_clear_resize_widgets (container); + + gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL); if (GTK_OBJECT_CLASS (parent_class)->destroy) @@ -712,18 +697,6 @@ gtk_container_set_arg (GtkContainer *container, case ARG_BORDER_WIDTH: gtk_container_border_width (container, GTK_VALUE_ULONG (*arg)); break; - case ARG_AUTO_RESIZE: - if (GTK_VALUE_BOOL (*arg)) - gtk_container_enable_resize (container); - else - gtk_container_disable_resize (container); - break; - case ARG_BLOCK_RESIZE: - if (GTK_VALUE_BOOL (*arg)) - gtk_container_block_resize (container); - else - gtk_container_unblock_resize (container); - break; case ARG_CHILD: gtk_container_add (container, GTK_WIDGET (GTK_VALUE_OBJECT (*arg))); break; @@ -742,12 +715,6 @@ gtk_container_get_arg (GtkContainer *container, case ARG_BORDER_WIDTH: GTK_VALUE_ULONG (*arg) = container->border_width; break; - case ARG_AUTO_RESIZE: - GTK_VALUE_BOOL (*arg) = container->auto_resize; - break; - case ARG_BLOCK_RESIZE: - GTK_VALUE_BOOL (*arg) = container->block_resize; - break; default: arg->type = GTK_TYPE_INVALID; break; @@ -799,65 +766,202 @@ gtk_container_remove (GtkContainer *container, void gtk_container_disable_resize (GtkContainer *container) { + g_warning ("gtk_container_disable_resize does nothing!"); +} + +void +gtk_container_enable_resize (GtkContainer *container) +{ + g_warning ("gtk_container_enable_resize does nothing!"); +} + +void +gtk_container_block_resize (GtkContainer *container) +{ g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); - container->auto_resize = FALSE; } void -gtk_container_enable_resize (GtkContainer *container) +gtk_container_unblock_resize (GtkContainer *container) { g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); + +} + +void +gtk_container_clear_resize_widgets (GtkContainer *container) +{ + GSList *node; + + g_return_if_fail (container != NULL); + g_return_if_fail (GTK_IS_CONTAINER (container)); - container->auto_resize = TRUE; - if (container->need_resize) + node = container->resize_widgets; + + while (node) { - container->need_resize = FALSE; - gtk_widget_queue_resize (GTK_WIDGET (container)); + GtkWidget *widget = node->data; + + GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED); + node = node->next; } + + g_slist_free (container->resize_widgets); + container->resize_widgets = NULL; } void -gtk_container_block_resize (GtkContainer *container) +gtk_container_set_resize_mode (GtkContainer *container, + GtkResizeMode resize_mode) { g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); + g_return_if_fail (!(GTK_WIDGET_TOPLEVEL (container) && + resize_mode == GTK_RESIZE_PARENT)); + + container->resize_mode = resize_mode; - container->block_resize = TRUE; + if (container->resize_widgets != NULL) + { + if (resize_mode == GTK_RESIZE_IMMEDIATE) + gtk_container_check_resize (container); + else if (resize_mode == GTK_RESIZE_PARENT) + { + gtk_widget_queue_resize (GTK_WIDGET (container)); + container->resize_widgets = NULL; + } + } } void -gtk_container_unblock_resize (GtkContainer *container) +gtk_container_check_resize (GtkContainer *container) { g_return_if_fail (container != NULL); g_return_if_fail (GTK_IS_CONTAINER (container)); + + gtk_signal_emit (GTK_OBJECT (container), container_signals[CHECK_RESIZE]); +} + +gint +gtk_container_need_resize (GtkContainer *container) +{ + gtk_container_check_resize (container); + return TRUE; +} + +static void +gtk_container_real_check_resize (GtkContainer *container) +{ + GtkWidget *widget; + + g_return_if_fail (container != NULL); + g_return_if_fail (GTK_IS_CONTAINER (container)); + + widget = GTK_WIDGET (container); + + gtk_widget_size_request (widget, &widget->requisition); - container->block_resize = FALSE; + if ((widget->requisition.width > widget->allocation.width) || + (widget->requisition.height > widget->allocation.height)) + { + gtk_container_clear_resize_widgets (container); + gtk_widget_queue_resize (widget); + } + else + { + gtk_container_resize_children (container); + } } -gint -gtk_container_need_resize (GtkContainer *container) +/* The window hasn't changed size but one of its children + * queued a resize request. Which means that the allocation + * is not sufficient for the requisition of some child. + * We've already performed a size request at this point, + * so we simply need to run through the list of resize + * widgets and reallocate their sizes appropriately. We + * make the optimization of not performing reallocation + * for a widget who also has a parent in the resize widgets + * list. GTK_RESIZE_NEEDED is used for flagging those + * parents inside this function. + */ +void +gtk_container_resize_children (GtkContainer *container) { - gint return_val; + GtkWidget *widget; + GSList *resize_widgets; + GSList *resize_containers; + GSList *node; - g_return_val_if_fail (container != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE); + resize_widgets = container->resize_widgets; + container->resize_widgets = NULL; - return_val = FALSE; + g_return_if_fail (container != NULL); + g_return_if_fail (GTK_IS_CONTAINER (container)); + + for (node = resize_widgets; node; node = node->next) + { + widget = node->data; + + GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED); + + while (widget && widget->parent && + ((widget->allocation.width < widget->requisition.width) || + (widget->allocation.height < widget->requisition.height))) + widget = widget->parent; + + GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED); + node->data = widget; + } + + resize_containers = NULL; - if (!container->block_resize) + for (node = resize_widgets; node; node = node->next) { - if (container->auto_resize) - gtk_signal_emit (GTK_OBJECT (container), - container_signals[NEED_RESIZE], - &return_val); + GtkWidget *resize_container; + + widget = node->data; + + if (!GTK_WIDGET_RESIZE_NEEDED (widget)) + continue; + + resize_container = widget->parent; + + if (resize_container) + { + GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED); + widget = resize_container->parent; + + while (widget) + { + if (GTK_WIDGET_RESIZE_NEEDED (widget)) + { + GTK_PRIVATE_UNSET_FLAG (resize_container, GTK_RESIZE_NEEDED); + resize_container = widget; + } + widget = widget->parent; + } + } else - container->need_resize = TRUE; + resize_container = widget; + + if (!g_slist_find (resize_containers, resize_container)) + resize_containers = g_slist_prepend (resize_containers, + resize_container); } + g_slist_free (resize_widgets); - return return_val; + for (node = resize_containers; node; node = node->next) + { + widget = node->data; + + GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED); + gtk_widget_size_allocate (widget, &widget->allocation); + gtk_widget_queue_draw (widget); + } + g_slist_free (resize_containers); } void @@ -1082,33 +1186,6 @@ gtk_container_marshal_signal_3 (GtkObject *object, *return_val = (* rfunc) (object, GTK_VALUE_ENUM(args[0]), func_data); } -static void -gtk_container_marshal_signal_4 (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args) -{ - GtkContainerSignal4 rfunc; - gint *return_val; - - rfunc = (GtkContainerSignal4) func; - return_val = GTK_RETLOC_BOOL (args[0]); - - *return_val = (* rfunc) (object, func_data); -} - -static gint -gtk_container_real_need_resize (GtkContainer *container) -{ - g_return_val_if_fail (container != NULL, FALSE); - g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE); - - if (GTK_WIDGET_VISIBLE (container) && container->widget.parent) - return gtk_container_need_resize (GTK_CONTAINER (container->widget.parent)); - - return FALSE; -} - static gint gtk_container_real_focus (GtkContainer *container, GtkDirectionType direction) diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h index 62916110c..72cf24ea5 100644 --- a/gtk/gtkcontainer.h +++ b/gtk/gtkcontainer.h @@ -49,9 +49,8 @@ struct _GtkContainer GtkWidget *focus_child; guint border_width : 16; - guint auto_resize : 1; guint need_resize : 1; - guint block_resize : 1; + guint resize_mode : 2; /* The list of children that requested a resize @@ -69,7 +68,7 @@ struct _GtkContainerClass GtkWidget *widget); void (* remove) (GtkContainer *container, GtkWidget *widget); - gint (* need_resize) (GtkContainer *container); + void (* check_resize) (GtkContainer *container); void (* foreach) (GtkContainer *container, GtkCallback callback, gpointer callbabck_data); @@ -88,6 +87,7 @@ struct _GtkContainerClass guint arg_id); }; +/* Application-level methods */ GtkType gtk_container_get_type (void); void gtk_container_border_width (GtkContainer *container, @@ -96,11 +96,12 @@ void gtk_container_add (GtkContainer *container, GtkWidget *widget); void gtk_container_remove (GtkContainer *container, GtkWidget *widget); -void gtk_container_disable_resize (GtkContainer *container); -void gtk_container_enable_resize (GtkContainer *container); -void gtk_container_block_resize (GtkContainer *container); -void gtk_container_unblock_resize (GtkContainer *container); -gint gtk_container_need_resize (GtkContainer *container); + +void gtk_container_set_resize_mode (GtkContainer *container, + GtkResizeMode resize_mode); + +void gtk_container_check_resize (GtkContainer *container); + void gtk_container_foreach (GtkContainer *container, GtkCallback callback, gpointer callback_data); @@ -114,16 +115,20 @@ void gtk_container_foreach_full (GtkContainer *container, gpointer callback_data, GtkDestroyNotify notify); GList* gtk_container_children (GtkContainer *container); -void gtk_container_register_toplevel (GtkContainer *container); -void gtk_container_unregister_toplevel (GtkContainer *container); gint gtk_container_focus (GtkContainer *container, GtkDirectionType direction); + +/* Widget-level methods */ + void gtk_container_set_focus_child (GtkContainer *container, GtkWidget *child); void gtk_container_set_focus_vadjustment (GtkContainer *container, GtkAdjustment *adjustment); void gtk_container_set_focus_hadjustment (GtkContainer *container, GtkAdjustment *adjustment); +void gtk_container_register_toplevel (GtkContainer *container); +void gtk_container_unregister_toplevel (GtkContainer *container); +void gtk_container_resize_children (GtkContainer *container); GtkType gtk_container_child_type (GtkContainer *container); @@ -173,8 +178,21 @@ void gtk_container_add_with_argv (GtkContainer *container, GtkArg *args); +/* Non-public methods */ +void gtk_container_clear_resize_widgets (GtkContainer *container); + +/* Deprecated methods */ +/* completely non-functional */ +void gtk_container_disable_resize (GtkContainer *container); +void gtk_container_enable_resize (GtkContainer *container); + +/* Use gtk_container_set_resize_mode() instead */ +void gtk_container_block_resize (GtkContainer *container); +void gtk_container_unblock_resize (GtkContainer *container); +/* Use gtk_container_check_resize() instead */ +gint gtk_container_need_resize (GtkContainer *container); #ifdef __cplusplus } diff --git a/gtk/gtkeditable.c b/gtk/gtkeditable.c index d5803634c..1c116962a 100644 --- a/gtk/gtkeditable.c +++ b/gtk/gtkeditable.c @@ -33,27 +33,45 @@ #define INNER_BORDER 2 enum { - ACTIVATE, CHANGED, INSERT_TEXT, DELETE_TEXT, + /* Binding actions */ + ACTIVATE, + MOVE_CURSOR, + MOVE_WORD, + MOVE_PAGE, + MOVE_TO_ROW, + MOVE_TO_COLUMN, + KILL_CHAR, + KILL_WORD, + KILL_LINE, + CUT_CLIPBOARD, + COPY_CLIPBOARD, + PASTE_CLIPBOARD, LAST_SIGNAL }; -static void gtk_editable_class_init (GtkEditableClass *klass); -static void gtk_editable_init (GtkEditable *editable); -static void gtk_editable_finalize (GtkObject *object); -static gint gtk_editable_selection_clear (GtkWidget *widget, - GdkEventSelection *event); -static void gtk_editable_selection_handler (GtkWidget *widget, - GtkSelectionData *selection_data, - gpointer data); -static void gtk_editable_selection_received (GtkWidget *widget, - GtkSelectionData *selection_data); - -static void gtk_editable_set_selection (GtkEditable *editable, - gint start, - gint end); +static void gtk_editable_class_init (GtkEditableClass *klass); +static void gtk_editable_init (GtkEditable *editable); +static void gtk_editable_finalize (GtkObject *object); +static gint gtk_editable_selection_clear (GtkWidget *widget, + GdkEventSelection *event); +static void gtk_editable_selection_handler (GtkWidget *widget, + GtkSelectionData *selection_data, + gpointer data); +static void gtk_editable_selection_received (GtkWidget *widget, + GtkSelectionData *selection_data); + +static void gtk_editable_set_selection (GtkEditable *editable, + gint start, + gint end); +static guint32 gtk_editable_get_event_time (GtkEditable *editable); + +static void gtk_real_editable_cut_clipboard (GtkEditable *editable); +static void gtk_real_editable_copy_clipboard (GtkEditable *editable); +static void gtk_real_editable_paste_clipboard (GtkEditable *editable); + static void gtk_editable_marshal_signal_1 (GtkObject * object, GtkSignalFunc func, @@ -63,6 +81,10 @@ static void gtk_editable_marshal_signal_2 (GtkObject * object, GtkSignalFunc func, gpointer func_data, GtkArg * args); +static void gtk_editable_marshal_signal_3 (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, + GtkArg * args); static GtkWidgetClass *parent_class = NULL; static guint editable_signals[LAST_SIGNAL] = { 0 }; @@ -70,17 +92,21 @@ static GdkAtom ctext_atom = GDK_NONE; static GdkAtom text_atom = GDK_NONE; static GdkAtom clipboard_atom = GDK_NONE; -typedef void (*GtkTextSignal1) (GtkObject * object, +typedef void (*GtkEditableSignal1) (GtkObject * object, gchar *arg1, gint arg2, gint *arg3, gpointer data); -typedef void (*GtkTextSignal2) (GtkObject * object, +typedef void (*GtkEditableSignal2) (GtkObject * object, gint arg1, gint arg2, gpointer data); +typedef void (*GtkEditableSignal3) (GtkObject * object, + gint arg1, + gpointer data); + guint gtk_editable_get_type (void) { @@ -116,14 +142,6 @@ gtk_editable_class_init (GtkEditableClass *class) parent_class = gtk_type_class (gtk_widget_get_type ()); - editable_signals[ACTIVATE] = - gtk_signal_new ("activate", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (GtkEditableClass, activate), - gtk_signal_default_marshaller, - GTK_TYPE_NONE, 0); - editable_signals[CHANGED] = gtk_signal_new ("changed", GTK_RUN_LAST, @@ -155,6 +173,112 @@ gtk_editable_class_init (GtkEditableClass *class) GTK_TYPE_INT, GTK_TYPE_INT); + editable_signals[ACTIVATE] = + gtk_signal_new ("activate", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, activate), + gtk_signal_default_marshaller, + GTK_TYPE_NONE, 0); + + editable_signals[MOVE_CURSOR] = + gtk_signal_new ("move_cursor", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, move_cursor), + gtk_editable_marshal_signal_2, + GTK_TYPE_NONE, 2, + GTK_TYPE_INT, + GTK_TYPE_INT); + + editable_signals[MOVE_WORD] = + gtk_signal_new ("move_word", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, move_word), + gtk_editable_marshal_signal_3, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + + editable_signals[MOVE_PAGE] = + gtk_signal_new ("move_page", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, move_page), + gtk_editable_marshal_signal_2, + GTK_TYPE_NONE, 2, + GTK_TYPE_INT, + GTK_TYPE_INT); + + editable_signals[MOVE_TO_ROW] = + gtk_signal_new ("move_to_row", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, move_to_row), + gtk_editable_marshal_signal_3, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + + editable_signals[MOVE_TO_COLUMN] = + gtk_signal_new ("move_to_column", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, move_to_column), + gtk_editable_marshal_signal_3, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + + editable_signals[KILL_CHAR] = + gtk_signal_new ("kill_char", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, kill_char), + gtk_editable_marshal_signal_3, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + + editable_signals[KILL_WORD] = + gtk_signal_new ("kill_word", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, kill_word), + gtk_editable_marshal_signal_3, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + + editable_signals[KILL_LINE] = + gtk_signal_new ("kill_line", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, kill_line), + gtk_editable_marshal_signal_3, + GTK_TYPE_NONE, 1, + GTK_TYPE_INT); + + editable_signals[CUT_CLIPBOARD] = + gtk_signal_new ("cut_clipboard", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, cut_clipboard), + gtk_signal_default_marshaller, + GTK_TYPE_NONE, 0); + + editable_signals[COPY_CLIPBOARD] = + gtk_signal_new ("copy_clipboard", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, copy_clipboard), + gtk_signal_default_marshaller, + GTK_TYPE_NONE, 0); + + editable_signals[PASTE_CLIPBOARD] = + gtk_signal_new ("paste_clipboard", + GTK_RUN_LAST | GTK_RUN_ACTION, + object_class->type, + GTK_SIGNAL_OFFSET (GtkEditableClass, paste_clipboard), + gtk_signal_default_marshaller, + GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, editable_signals, LAST_SIGNAL); object_class->finalize = gtk_editable_finalize; @@ -164,10 +288,28 @@ gtk_editable_class_init (GtkEditableClass *class) class->insert_text = NULL; class->delete_text = NULL; + class->changed = NULL; + + class->activate = NULL; + + class->move_cursor = NULL; + class->move_word = NULL; + class->move_page = NULL; + class->move_to_row = NULL; + class->move_to_column = NULL; + + class->kill_char = NULL; + class->kill_word = NULL; + class->kill_line = NULL; + + class->cut_clipboard = gtk_real_editable_cut_clipboard; + class->copy_clipboard = gtk_real_editable_copy_clipboard; + class->paste_clipboard = gtk_real_editable_paste_clipboard; + class->update_text = NULL; class->get_chars = NULL; class->set_selection = NULL; - class->changed = NULL; + class->set_position = NULL; } static void @@ -598,16 +740,77 @@ gtk_editable_select_region (GtkEditable *editable, gtk_editable_set_selection (editable, start, end); } +/* Get the timestamp of the current event. Actually, the only thing + * we really care about below is the key event + */ +static guint32 +gtk_editable_get_event_time (GtkEditable *editable) +{ + GdkEvent *event; + + event = gtk_get_current_event(); + + if (event) + switch (event->type) + { + case GDK_MOTION_NOTIFY: + return event->motion.time; + case GDK_BUTTON_PRESS: + case GDK_2BUTTON_PRESS: + case GDK_3BUTTON_PRESS: + case GDK_BUTTON_RELEASE: + return event->button.time; + case GDK_KEY_PRESS: + case GDK_KEY_RELEASE: + return event->key.time; + case GDK_ENTER_NOTIFY: + case GDK_LEAVE_NOTIFY: + return event->crossing.time; + case GDK_PROPERTY_NOTIFY: + return event->property.time; + case GDK_SELECTION_CLEAR: + case GDK_SELECTION_REQUEST: + case GDK_SELECTION_NOTIFY: + return event->selection.time; + case GDK_PROXIMITY_IN: + case GDK_PROXIMITY_OUT: + return event->proximity.time; + default: /* use current time */ + } + + return GDK_CURRENT_TIME; +} + void -gtk_editable_cut_clipboard (GtkEditable *editable, guint32 time) +gtk_editable_cut_clipboard (GtkEditable *editable) { - gtk_editable_copy_clipboard (editable, time); - gtk_editable_delete_selection (editable); + gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CUT_CLIPBOARD]); +} + +void +gtk_editable_copy_clipboard (GtkEditable *editable) +{ + gtk_signal_emit (GTK_OBJECT (editable), editable_signals[COPY_CLIPBOARD]); } void -gtk_editable_copy_clipboard (GtkEditable *editable, guint32 time) +gtk_editable_paste_clipboard (GtkEditable *editable) { + gtk_signal_emit (GTK_OBJECT (editable), editable_signals[PASTE_CLIPBOARD]); +} + +static void +gtk_real_editable_cut_clipboard (GtkEditable *editable) +{ + gtk_real_editable_copy_clipboard (editable); + gtk_editable_delete_selection (editable); +} + +static void +gtk_real_editable_copy_clipboard (GtkEditable *editable) +{ + guint32 time = gtk_editable_get_event_time (editable); + gint selection_start_pos; gint selection_end_pos; @@ -625,9 +828,11 @@ gtk_editable_copy_clipboard (GtkEditable *editable, guint32 time) } } -void -gtk_editable_paste_clipboard (GtkEditable *editable, guint32 time) +static void +gtk_real_editable_paste_clipboard (GtkEditable *editable) { + guint32 time = gtk_editable_get_event_time (editable); + if (editable->editable) gtk_selection_convert (GTK_WIDGET(editable), clipboard_atom, ctext_atom, time); @@ -645,13 +850,13 @@ gtk_editable_marshal_signal_1 (GtkObject * object, gpointer func_data, GtkArg * args) { - GtkTextSignal1 rfunc; + GtkEditableSignal1 rfunc; - rfunc = (GtkTextSignal1) func; + rfunc = (GtkEditableSignal1) func; (*rfunc) (object, GTK_VALUE_STRING (args[0]), - GTK_VALUE_INT (args[1]), - GTK_VALUE_POINTER (args[2]), + GTK_VALUE_INT (args[1]), + GTK_VALUE_POINTER (args[2]), func_data); } @@ -661,11 +866,25 @@ gtk_editable_marshal_signal_2 (GtkObject * object, gpointer func_data, GtkArg * args) { - GtkTextSignal2 rfunc; + GtkEditableSignal2 rfunc; + + rfunc = (GtkEditableSignal2) func; + + (*rfunc) (object, GTK_VALUE_INT (args[0]), + GTK_VALUE_INT (args[1]), + func_data); +} + +static void +gtk_editable_marshal_signal_3 (GtkObject * object, + GtkSignalFunc func, + gpointer func_data, + GtkArg * args) +{ + GtkEditableSignal3 rfunc; - rfunc = (GtkTextSignal2) func; + rfunc = (GtkEditableSignal3) func; (*rfunc) (object, GTK_VALUE_INT (args[0]), - GTK_VALUE_INT (args[1]), func_data); } diff --git a/gtk/gtkeditable.h b/gtk/gtkeditable.h index 2c4d3bab9..8a374bb25 100644 --- a/gtk/gtkeditable.h +++ b/gtk/gtkeditable.h @@ -57,7 +57,9 @@ struct _GtkEditable struct _GtkEditableClass { GtkWidgetClass parent_class; - + + /* Signals for notification/filtering of changes */ + void (* changed) (GtkEditable *editable); void (* insert_text) (GtkEditable *editable, const gchar *text, gint length, @@ -65,6 +67,36 @@ struct _GtkEditableClass void (* delete_text) (GtkEditable *editable, gint start_pos, gint end_pos); + + /* Bindings actions */ + void (* activate) (GtkEditable *editable); + void (* move_cursor) (GtkEditable *editable, + gint x, + gint y); + void (* move_word) (GtkEditable *editable, + gint n); + void (* move_page) (GtkEditable *editable, + gint x, + gint y); + void (* move_to_row) (GtkEditable *editable, + gint row); + void (* move_to_column) (GtkEditable *editable, + gint row); + void (* kill_char) (GtkEditable *editable, + gint direction); + void (* kill_word) (GtkEditable *editable, + gint direction); + void (* kill_line) (GtkEditable *editable, + gint direction); + void (* cut_clipboard) (GtkEditable *editable); + void (* copy_clipboard) (GtkEditable *editable); + void (* paste_clipboard) (GtkEditable *editable); + + /* Virtual functions. get_chars is in paricular not a signal because + * it returns malloced memory. The others are not signals because + * they would not be particularly useful as such. (All changes to + * selection and position do not go through these functions) + */ void (* update_text) (GtkEditable *editable, gint start_pos, gint end_pos); @@ -74,8 +106,6 @@ struct _GtkEditableClass void (* set_selection)(GtkEditable *editable, gint start_pos, gint end_pos); - void (* activate) (GtkEditable *editable); - void (* changed) (GtkEditable *editable); void (* set_position) (GtkEditable *editable, gint position); }; @@ -94,12 +124,9 @@ void gtk_editable_delete_text (GtkEditable *editable, gchar * gtk_editable_get_chars (GtkEditable *editable, gint start_pos, gint end_pos); -void gtk_editable_cut_clipboard (GtkEditable *editable, - guint32 time); -void gtk_editable_copy_clipboard (GtkEditable *editable, - guint32 time); -void gtk_editable_paste_clipboard (GtkEditable *editable, - guint32 time); +void gtk_editable_cut_clipboard (GtkEditable *editable); +void gtk_editable_copy_clipboard (GtkEditable *editable); +void gtk_editable_paste_clipboard (GtkEditable *editable); void gtk_editable_claim_selection (GtkEditable *editable, gboolean claim, guint32 time); diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 60c1ddacc..db4a957cb 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -88,6 +88,22 @@ static gchar *gtk_entry_get_chars (GtkEditable *editable, gint start_pos, gint end_pos); +/* Binding actions */ +static void gtk_entry_move_cursor (GtkEditable *editable, + gint x, + gint y); +static void gtk_entry_move_word (GtkEditable *editable, + gint n); +static void gtk_entry_move_to_column (GtkEditable *editable, + gint row); +static void gtk_entry_kill_char (GtkEditable *editable, + gint direction); +static void gtk_entry_kill_word (GtkEditable *editable, + gint direction); +static void gtk_entry_kill_line (GtkEditable *editable, + gint direction); + +/* To be removed */ static void gtk_move_forward_character (GtkEntry *entry); static void gtk_move_backward_character (GtkEntry *entry); static void gtk_move_forward_word (GtkEntry *entry); @@ -125,7 +141,7 @@ static GtkTextFunction control_keys[26] = { (GtkTextFunction)gtk_move_beginning_of_line, /* a */ (GtkTextFunction)gtk_move_backward_character, /* b */ - gtk_editable_copy_clipboard, /* c */ + (GtkTextFunction)gtk_editable_copy_clipboard, /* c */ (GtkTextFunction)gtk_delete_forward_character, /* d */ (GtkTextFunction)gtk_move_end_of_line, /* e */ (GtkTextFunction)gtk_move_forward_character, /* f */ @@ -144,9 +160,9 @@ static GtkTextFunction control_keys[26] = NULL, /* s */ NULL, /* t */ (GtkTextFunction)gtk_delete_line, /* u */ - gtk_editable_paste_clipboard, /* v */ + (GtkTextFunction)gtk_editable_paste_clipboard, /* v */ (GtkTextFunction)gtk_delete_backward_word, /* w */ - gtk_editable_cut_clipboard, /* x */ + (GtkTextFunction)gtk_editable_cut_clipboard, /* x */ NULL, /* y */ NULL, /* z */ }; @@ -238,11 +254,19 @@ gtk_entry_class_init (GtkEntryClass *class) editable_class->insert_text = gtk_entry_insert_text; editable_class->delete_text = gtk_entry_delete_text; + editable_class->changed = (void (*)(GtkEditable *)) gtk_entry_adjust_scroll; + + editable_class->move_cursor = gtk_entry_move_cursor; + editable_class->move_word = gtk_entry_move_word; + editable_class->move_to_column = gtk_entry_move_to_column; + + editable_class->kill_char = gtk_entry_kill_char; + editable_class->kill_word = gtk_entry_kill_word; + editable_class->kill_line = gtk_entry_kill_line; + editable_class->update_text = gtk_entry_update_text; editable_class->get_chars = gtk_entry_get_chars; editable_class->set_selection = gtk_entry_set_selection; - editable_class->changed = (void (*)(GtkEditable *)) gtk_entry_adjust_scroll; - editable_class->activate = NULL; editable_class->set_position = gtk_entry_set_position_from_editable; } @@ -940,11 +964,11 @@ gtk_entry_key_press (GtkWidget *widget, if (event->state & GDK_SHIFT_MASK) { extend_selection = FALSE; - gtk_editable_paste_clipboard (editable, event->time); + gtk_editable_paste_clipboard (editable); } else if (event->state & GDK_CONTROL_MASK) { - gtk_editable_copy_clipboard (editable, event->time); + gtk_editable_copy_clipboard (editable); } else { @@ -958,7 +982,7 @@ gtk_entry_key_press (GtkWidget *widget, else if (event->state & GDK_SHIFT_MASK) { extend_selection = FALSE; - gtk_editable_cut_clipboard (editable, event->time); + gtk_editable_cut_clipboard (editable); } else gtk_delete_forward_character (entry); @@ -1796,45 +1820,81 @@ gtk_entry_get_chars (GtkEditable *editable, return NULL; } -static void -gtk_move_forward_character (GtkEntry *entry) +static void +gtk_entry_move_cursor (GtkEditable *editable, + gint x, + gint y) { gint len; - GtkEditable *editable; - editable = GTK_EDITABLE (entry); + GtkEntry *entry; + entry = GTK_ENTRY (editable); - if (gtk_use_mb) + /* Horizontal motion */ + if (x > 0) { - if (editable->current_pos < entry->text_length) + while (x-- != 0) { - len = mblen (entry->text+editable->current_pos, MB_CUR_MAX); - editable->current_pos += (len>0)? len:1; + if (gtk_use_mb) + { + if (editable->current_pos < entry->text_length) + { + len = mblen (entry->text+editable->current_pos, MB_CUR_MAX); + editable->current_pos += (len>0)? len:1; + } + if (editable->current_pos > entry->text_length) + editable->current_pos = entry->text_length; + } + else + { + if (editable->current_pos < entry->text_length) + editable->current_pos ++; + } } - if (editable->current_pos > entry->text_length) - editable->current_pos = entry->text_length; } - else + else if (x < 0) { - if (editable->current_pos < entry->text_length) - editable->current_pos ++; + while (x++ != 0) + { + if (0 < editable->current_pos) + { + if (gtk_use_mb) + editable->current_pos = + entry->char_pos[gtk_entry_find_char (entry, editable->current_pos - 1)]; + else + editable->current_pos--; + } + } } + + /* Ignore vertical motion */ } static void -gtk_move_backward_character (GtkEntry *entry) +gtk_move_forward_character (GtkEntry *entry) { - GtkEditable *editable; + gtk_entry_move_cursor (GTK_EDITABLE (entry), 1, 0); +} - editable = GTK_EDITABLE (entry); +static void +gtk_move_backward_character (GtkEntry *entry) +{ + gtk_entry_move_cursor (GTK_EDITABLE (entry), -1, 0); +} - if (0 < editable->current_pos) +static void +gtk_entry_move_word (GtkEditable *editable, + gint n) +{ + if (n > 0) { - if (gtk_use_mb) - editable->current_pos = - entry->char_pos[gtk_entry_find_char (entry, editable->current_pos - 1)]; - else - editable->current_pos--; + while (n-- != 0) + gtk_move_forward_word (GTK_ENTRY (editable)); + } + else if (n < 0) + { + while (n++ != 0) + gtk_move_backward_word (GTK_ENTRY (editable)); } } @@ -1968,85 +2028,111 @@ gtk_move_backward_word (GtkEntry *entry) } static void +gtk_entry_move_to_column (GtkEditable *editable, gint column) +{ + GtkEntry *entry; + + entry = GTK_ENTRY (editable); + + if (column < 0 || column > entry->nchars) + editable->current_pos = entry->text_length; + else + editable->current_pos = entry->char_pos[column]; +} + +static void gtk_move_beginning_of_line (GtkEntry *entry) { - GTK_EDITABLE (entry)->current_pos = 0; + gtk_entry_move_to_column (GTK_EDITABLE (entry), 0); } static void gtk_move_end_of_line (GtkEntry *entry) { - GTK_EDITABLE (entry)->current_pos = entry->text_length; + gtk_entry_move_to_column (GTK_EDITABLE (entry), -1); } static void -gtk_delete_forward_character (GtkEntry *entry) +gtk_entry_kill_char (GtkEditable *editable, + gint direction) { - GtkEditable *editable; - gint old_pos; - - editable = GTK_EDITABLE (entry); - if (editable->selection_start_pos != editable->selection_end_pos) gtk_editable_delete_selection (editable); else { - old_pos = editable->current_pos; - gtk_move_forward_character (entry); - gtk_editable_delete_text (editable, old_pos, editable->current_pos); + gint old_pos = editable->current_pos; + if (direction >= 0) + { + gtk_entry_move_cursor (editable, 1, 0); + gtk_editable_delete_text (editable, old_pos, editable->current_pos); + } + else + { + gtk_entry_move_cursor (editable, -1, 0); + gtk_editable_delete_text (editable, editable->current_pos, old_pos); + } } } static void -gtk_delete_backward_character (GtkEntry *entry) +gtk_delete_forward_character (GtkEntry *entry) { - GtkEditable *editable; - gint old_pos; + gtk_entry_kill_char (GTK_EDITABLE (entry), 1); +} - editable = GTK_EDITABLE (entry); +static void +gtk_delete_backward_character (GtkEntry *entry) +{ + gtk_entry_kill_char (GTK_EDITABLE (entry), -1); +} +static void +gtk_entry_kill_word (GtkEditable *editable, + gint direction) +{ if (editable->selection_start_pos != editable->selection_end_pos) gtk_editable_delete_selection (editable); else { - old_pos = editable->current_pos; - gtk_move_backward_character (entry); - gtk_editable_delete_text (editable, editable->current_pos, old_pos); + gint old_pos = editable->current_pos; + if (direction >= 0) + { + gtk_entry_move_word (editable, 1); + gtk_editable_delete_text (editable, old_pos, editable->current_pos); + } + else + { + gtk_entry_move_word (editable, -1); + gtk_editable_delete_text (editable, editable->current_pos, old_pos); + } } } static void gtk_delete_forward_word (GtkEntry *entry) { - GtkEditable *editable; - gint old_pos; - - editable = GTK_EDITABLE (entry); - - if (editable->selection_start_pos != editable->selection_end_pos) - gtk_editable_delete_selection (editable); - else - { - old_pos = editable->current_pos; - gtk_move_forward_word (entry); - gtk_editable_delete_text (editable, old_pos, editable->current_pos); - } + gtk_entry_kill_word (GTK_EDITABLE (entry), 1); } static void gtk_delete_backward_word (GtkEntry *entry) { - GtkEditable *editable; - gint old_pos; - - editable = GTK_EDITABLE (entry); + gtk_entry_kill_word (GTK_EDITABLE (entry), -1); +} - if (editable->selection_start_pos != editable->selection_end_pos) - gtk_editable_delete_selection (editable); +static void +gtk_entry_kill_line (GtkEditable *editable, + gint direction) +{ + gint old_pos = editable->current_pos; + if (direction >= 0) + { + gtk_entry_move_to_column (editable, -1); + gtk_editable_delete_text (editable, old_pos, editable->current_pos); + } else { - old_pos = editable->current_pos; - gtk_move_backward_word (entry); + gtk_entry_move_to_column (editable, 0); gtk_editable_delete_text (editable, editable->current_pos, old_pos); } } @@ -2054,7 +2140,8 @@ gtk_delete_backward_word (GtkEntry *entry) static void gtk_delete_line (GtkEntry *entry) { - gtk_editable_delete_text (GTK_EDITABLE(entry), 0, entry->text_length); + gtk_entry_move_to_column (GTK_EDITABLE (entry), 0); + gtk_entry_kill_line (GTK_EDITABLE (entry), 1); } static void diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index 615c0a8a7..7d82d8958 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -182,6 +182,14 @@ typedef enum GTK_RELIEF_NONE } GtkReliefStyle; +/* Resize type */ +typedef enum +{ + GTK_RESIZE_PARENT, /* Pass resize request to the parent */ + GTK_RESIZE_QUEUE, /* Queue resizes on this widget */ + GTK_RESIZE_IMMEDIATE, /* Perform the resizes now */ +} GtkResizeMode; + /* signal run types */ typedef enum /*< flags >*/ { diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c index a5fd49b6d..fd4d4ca52 100644 --- a/gtk/gtkfontsel.c +++ b/gtk/gtkfontsel.c @@ -176,14 +176,15 @@ struct _GtkFontSelInfo { guint16 *pixel_sizes; guint16 *point_sizes; - /* These are the arrays of all possible weights/slants/set widths/spacings - and the amount of space allocated for each array. The extra array is - used for the foundries strings. */ + /* These are the arrays of strings of all possible weights, slants, + set widths, spacings, charsets & foundries, and the amount of space + allocated for each array. */ gchar **properties[GTK_NUM_FONT_PROPERTIES]; guint16 nproperties[GTK_NUM_FONT_PROPERTIES]; guint16 space_allocated[GTK_NUM_FONT_PROPERTIES]; - /* Whether any scalable bitmap fonts are available. */ + /* Whether any scalable bitmap fonts are available. If not, the 'Allow + scaled bitmap fonts' toggle button is made insensitive. */ gboolean scaled_bitmaps_available; }; @@ -285,7 +286,9 @@ static gboolean gtk_font_selection_select_next (GtkFontSelection *fs, gint step); static void gtk_font_selection_show_available_styles (GtkFontSelection *fs); -static void gtk_font_selection_select_best_style (GtkFontSelection *fs); +static void gtk_font_selection_select_best_style (GtkFontSelection *fs, + gboolean use_first); +static gint gtk_font_selection_get_best_match (GtkFontSelection *fs); static void gtk_font_selection_select_style (GtkWidget *w, gint row, @@ -332,7 +335,7 @@ static gboolean gtk_font_selection_style_visible (GtkFontSelection *fs, gint style); static void gtk_font_selection_reset_filter (GtkWidget *w, gpointer data); -static void gtk_font_selection_toggle_filter (GtkWidget *w, +static void gtk_font_selection_on_clear_filter (GtkWidget *w, gpointer data); static void gtk_font_selection_apply_filter (GtkFontSelection *fs); static void gtk_font_selection_clear_filter (GtkFontSelection *fs); @@ -457,7 +460,7 @@ gtk_font_selection_init(GtkFontSelection *fontsel) fontsel->scroll_on_expose = TRUE; - /* Create the shell and vertical & horizontal boxes */ + /* Create the main notebook page. */ fontsel->main_vbox = gtk_vbox_new (FALSE, 4); gtk_widget_show (fontsel->main_vbox); gtk_container_border_width (GTK_CONTAINER (fontsel->main_vbox), 6); @@ -599,22 +602,12 @@ gtk_font_selection_init(GtkFontSelection *fontsel) gtk_widget_show (hbox); gtk_box_pack_start (GTK_BOX (fontsel->main_vbox), hbox, FALSE, TRUE, 0); - /* - fontsel->filter_button = gtk_check_button_new_with_label("Filter fonts"); - gtk_widget_show(fontsel->filter_button); - gtk_box_pack_start (GTK_BOX (hbox), fontsel->filter_button, FALSE, FALSE, 0); - gtk_widget_set_sensitive (fontsel->filter_button, FALSE); - gtk_signal_connect (GTK_OBJECT (fontsel->filter_button), "clicked", - GTK_SIGNAL_FUNC(gtk_font_selection_toggle_filter), - fontsel); - */ - fontsel->filter_button = gtk_button_new_with_label(" Clear Filter "); gtk_widget_show(fontsel->filter_button); gtk_box_pack_start (GTK_BOX (hbox), fontsel->filter_button, FALSE, FALSE, 0); gtk_widget_set_sensitive (fontsel->filter_button, FALSE); gtk_signal_connect (GTK_OBJECT (fontsel->filter_button), "clicked", - GTK_SIGNAL_FUNC(gtk_font_selection_toggle_filter), + GTK_SIGNAL_FUNC(gtk_font_selection_on_clear_filter), fontsel); fontsel->scaled_bitmaps_button @@ -710,8 +703,6 @@ gtk_font_selection_init(GtkFontSelection *fontsel) gtk_clist_freeze (GTK_CLIST(fontsel->info_clist)); row_text[1] = ""; row_text[2] = ""; - /* Note: we skip the last field, encoding, since it is shown as part of the - charset. */ for (i = 0; i < GTK_XLFD_NUM_FIELDS; i++) { row_text[0] = xlfd_field_names[i]; @@ -789,7 +780,7 @@ gtk_font_selection_init(GtkFontSelection *fontsel) GTK_POLICY_AUTOMATIC); gtk_widget_show(clist); - /* For the bottom-right cell we add the 'Reset' button. */ + /* For the bottom-right cell we add the 'Clear Filter' button. */ if (top == 2 && left == 2) { vbox = gtk_vbox_new(FALSE, 0); @@ -803,7 +794,7 @@ gtk_font_selection_init(GtkFontSelection *fontsel) gtk_widget_show(alignment); gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, TRUE, 4); - button = gtk_button_new_with_label("Reset"); + button = gtk_button_new_with_label("Clear Filter"); gtk_widget_show(button); gtk_container_add(GTK_CONTAINER(alignment), button); gtk_signal_connect (GTK_OBJECT (button), "clicked", @@ -1000,7 +991,7 @@ gtk_font_selection_select_font (GtkWidget *w, fontsel->font_index = row; gtk_font_selection_show_available_styles (fontsel); - gtk_font_selection_select_best_style (fontsel); + gtk_font_selection_select_best_style (fontsel, TRUE); } @@ -1202,11 +1193,13 @@ gtk_font_selection_show_available_styles (GtkFontSelection *fontsel) However, the interface is so easy to use now I'm not sure it's worth it. Note: This will load a font. */ static void -gtk_font_selection_select_best_style(GtkFontSelection *fontsel) +gtk_font_selection_select_best_style(GtkFontSelection *fontsel, + gboolean use_first) { FontInfo *font; FontStyle *styles; - gint row, prop, style; + gint row, prop, style = -1, style_to_find; + gboolean found = FALSE; #ifdef FONTSEL_DEBUG g_print("In select_best_style\n"); @@ -1214,14 +1207,20 @@ gtk_font_selection_select_best_style(GtkFontSelection *fontsel) font = &fontsel_info->font_info[fontsel->font_index]; styles = &fontsel_info->font_styles[font->style_index]; - style = -1; /* Quite warning */ + /* If use_first is set, we just find the first style in the list, not + including charset items. */ + style_to_find = use_first ? -1 : gtk_font_selection_get_best_match (fontsel); + for (row = 0; row < GTK_CLIST(fontsel->font_style_clist)->rows; row++) { style = GPOINTER_TO_INT (gtk_clist_get_row_data (GTK_CLIST (fontsel->font_style_clist), row)); - if (style >= 0) - break; + if (style != -1 && (style_to_find == -1 || style_to_find == style)) + { + found = TRUE; + break; + } } - g_return_if_fail (style != -1); + g_return_if_fail (found); fontsel->style = style; @@ -1229,6 +1228,9 @@ gtk_font_selection_select_best_style(GtkFontSelection *fontsel) fontsel->property_values[prop] = styles[fontsel->style].properties[prop]; gtk_clist_select_row(GTK_CLIST(fontsel->font_style_clist), row, 0); + if (gtk_clist_row_is_visible(GTK_CLIST(fontsel->font_style_clist), row) + != GTK_VISIBILITY_FULL) + gtk_clist_moveto(GTK_CLIST(fontsel->font_style_clist), row, -1, 0.5, 0); gtk_font_selection_show_available_sizes (fontsel); gtk_font_selection_select_best_size (fontsel); } @@ -1296,8 +1298,11 @@ gtk_font_selection_toggle_scaled_bitmaps (GtkWidget *w, fontsel->scale_bitmapped_fonts = GTK_TOGGLE_BUTTON(w)->active ? TRUE : FALSE; - gtk_font_selection_show_available_sizes (fontsel); - gtk_font_selection_select_best_size (fontsel); + if (fontsel->font_index != -1) + { + gtk_font_selection_show_available_sizes (fontsel); + gtk_font_selection_select_best_size (fontsel); + } } @@ -1828,6 +1833,7 @@ gtk_font_selection_show_font_info (GtkFontSelection *fontsel) } if (!shown_actual_fields) { + gtk_entry_set_text(GTK_ENTRY(fontsel->actual_font_name), ""); for (i = 0; i < GTK_XLFD_NUM_FIELDS; i++) { gtk_clist_set_text(GTK_CLIST(fontsel->info_clist), i, 2, @@ -1972,23 +1978,12 @@ gtk_font_selection_filter_fonts (GtkFontSelection *fontsel) { gtk_widget_set_sensitive(fontsel->filter_button, FALSE); gtk_label_set(GTK_LABEL(fontsel->font_label), "Font:"); - /* - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->filter_button), - FALSE); - */ gtk_font_selection_apply_filter(fontsel); } else { gtk_widget_set_sensitive(fontsel->filter_button, TRUE); gtk_label_set(GTK_LABEL(fontsel->font_label), "Font: [Filtered]"); - /* - if (GTK_TOGGLE_BUTTON(fontsel->filter_button)->active) - gtk_font_selection_apply_filter(fontsel); - else - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->filter_button), - TRUE); - */ gtk_font_selection_apply_filter(fontsel); } } @@ -2158,23 +2153,13 @@ gtk_font_selection_reset_filter (GtkWidget *w, /* This clears the filter, showing all fonts and styles again. */ static void -gtk_font_selection_toggle_filter (GtkWidget *w, - gpointer data) +gtk_font_selection_on_clear_filter (GtkWidget *w, + gpointer data) { GtkFontSelection *fontsel; fontsel = GTK_FONT_SELECTION(data); - - /* - if (GTK_TOGGLE_BUTTON(fontsel->filter_button)->active) - gtk_font_selection_apply_filter(fontsel); - else - gtk_font_selection_clear_filter(fontsel); - */ - gtk_font_selection_clear_filter(fontsel); - gtk_widget_set_sensitive(fontsel->filter_button, FALSE); - gtk_label_set(GTK_LABEL(fontsel->font_label), "Font:"); } @@ -2198,10 +2183,13 @@ gtk_font_selection_clear_filter (GtkFontSelection *fontsel) fontsel->property_nfilters[prop] = 0; } - /* TODO: Delete? */ /* Select all the '*'s on the filter page. */ gtk_font_selection_reset_filter(NULL, fontsel); + /* Update the main notebook page. */ + gtk_widget_set_sensitive(fontsel->filter_button, FALSE); + gtk_label_set(GTK_LABEL(fontsel->font_label), "Font:"); + /* If there is no filter at present just return. */ if (!filtered) return; @@ -2788,12 +2776,7 @@ gtk_font_selection_get_best_match(GtkFontSelection *fontsel) First we check the fontname is valid and try to find the font family - i.e. the name in the main list. If we can't find that, then just return. Next we try to set each of the properties according to the fontname. - Finally we select the font family & style in the clists. - Note that we have to be careful to make sure any callbacks do not try - to load the font unless we want them to. This is usually done by - setting the font/size in the fontsel struct before selecting rows or - buttons in the interface. The callbacks simply return if the value has - not changed. */ + Finally we select the font family & style in the clists. */ gboolean gtk_font_selection_set_font_name (GtkFontSelection *fontsel, const gchar *fontname) @@ -2871,13 +2854,7 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel, gtk_entry_set_text (GTK_ENTRY (fontsel->size_entry), buffer); /* Clear any current filter. */ - /* TODO: Delete? - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(fontsel->filter_button), - FALSE); - */ gtk_font_selection_clear_filter(fontsel); - gtk_widget_set_sensitive(fontsel->filter_button, FALSE); - gtk_label_set(GTK_LABEL(fontsel->font_label), "Font:"); /* Now find the best style match. */ fontsel->font_index = index; @@ -2888,14 +2865,8 @@ gtk_font_selection_set_font_name (GtkFontSelection *fontsel, fontsel->scroll_on_expose = TRUE; gtk_font_selection_show_available_styles (fontsel); - fontsel->style = gtk_font_selection_get_best_match (fontsel); - - gtk_clist_select_row(GTK_CLIST(fontsel->font_style_clist), - fontsel->style, 0); - gtk_font_selection_show_available_sizes (fontsel); - /* This will load the font. */ - gtk_font_selection_select_best_size (fontsel); + gtk_font_selection_select_best_style (fontsel, FALSE); return TRUE; } diff --git a/gtk/gtkfontsel.h b/gtk/gtkfontsel.h index 98948f3ae..01af04e03 100644 --- a/gtk/gtkfontsel.h +++ b/gtk/gtkfontsel.h @@ -53,11 +53,12 @@ typedef struct _GtkFontSelectionDialogClass GtkFontSelectionDialogClass; /* This is the number of properties which we keep in the properties array, - i.e. Foundry, Weight, Slant, Set Width & Spacing. */ + i.e. Weight, Slant, Set Width, Spacing, Charset & Foundry. */ #define GTK_NUM_FONT_PROPERTIES 6 /* This is the number of properties each style has i.e. Weight, Slant, - Set Width & Spacing. Note that Foundry is not included. */ + Set Width, Spacing & Charset. Note that Foundry is not included, + since it is the same for all styles of the same FontInfo. */ #define GTK_NUM_STYLE_PROPERTIES 5 @@ -114,7 +115,7 @@ struct _GtkFontSelection gboolean scale_bitmapped_fonts; /* These are the current property settings. They are indexes into the - strings in the class' properties array. */ + strings in the GtkFontSelInfo properties array. */ guint16 property_values[GTK_NUM_STYLE_PROPERTIES]; /* These hold the arrays of current filter settings for each property. @@ -131,7 +132,7 @@ struct _GtkFontSelection struct _GtkFontSelectionClass { - GtkWindowClass parent_class; + GtkNotebookClass parent_class; }; diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 732f7431e..5f07d5e5a 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -306,6 +306,11 @@ gtk_init (int *argc, } (*argv)[i] = NULL; } + else if (strcmp ("--g-fatal-warnings", (*argv)[i]) == 0) + { + g_set_warning_handler ((GWarningFunc)g_error); + (*argv)[i] = NULL; + } i += 1; } diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 94db57efe..6a36f37a2 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -56,7 +56,7 @@ static gint gtk_menu_configure (GtkWidget *widget, GdkEventConfigure *event); static gint gtk_menu_key_press (GtkWidget *widget, GdkEventKey *event); -static gint gtk_menu_need_resize (GtkContainer *container); +static void gtk_menu_check_resize (GtkContainer *container); static void gtk_menu_deactivate (GtkMenuShell *menu_shell); static void gtk_menu_show_all (GtkWidget *widget); static void gtk_menu_hide_all (GtkWidget *widget); @@ -118,7 +118,7 @@ gtk_menu_class_init (GtkMenuClass *class) widget_class->show_all = gtk_menu_show_all; widget_class->hide_all = gtk_menu_hide_all; - container_class->need_resize = gtk_menu_need_resize; + container_class->check_resize = gtk_menu_check_resize; menu_shell_class->submenu_placement = GTK_LEFT_RIGHT; menu_shell_class->deactivate = gtk_menu_deactivate; @@ -129,6 +129,8 @@ gtk_menu_init (GtkMenu *menu) { GTK_WIDGET_SET_FLAGS (menu, GTK_TOPLEVEL); + gtk_container_set_resize_mode (GTK_CONTAINER (menu), GTK_RESIZE_QUEUE); + menu->parent_menu_item = NULL; menu->old_active_menu_item = NULL; menu->accel_group = NULL; @@ -440,7 +442,7 @@ gtk_menu_show (GtkWidget *widget) GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE); if (MENU_NEEDS_RESIZE (widget)) - gtk_container_need_resize (GTK_CONTAINER (widget)); + gtk_container_check_resize (GTK_CONTAINER (widget)); gtk_widget_map (widget); } @@ -858,14 +860,14 @@ gtk_menu_key_press (GtkWidget *widget, return FALSE; } -static gint -gtk_menu_need_resize (GtkContainer *container) +static void +gtk_menu_check_resize (GtkContainer *container) { GtkAllocation allocation; GtkWidget *widget; - g_return_val_if_fail (container != NULL, FALSE); - g_return_val_if_fail (GTK_IS_MENU (container), FALSE); + g_return_if_fail (container != NULL); + g_return_if_fail (GTK_IS_MENU (container)); widget = GTK_WIDGET (container); @@ -884,8 +886,6 @@ gtk_menu_need_resize (GtkContainer *container) } else MENU_NEEDS_RESIZE (container) = TRUE; - - return FALSE; } static void diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c index eec55f0bf..f9045807c 100644 --- a/gtk/gtkpixmap.c +++ b/gtk/gtkpixmap.c @@ -73,6 +73,7 @@ gtk_pixmap_init (GtkPixmap *pixmap) pixmap->pixmap = NULL; pixmap->mask = NULL; + pixmap->needs_clear = FALSE; } GtkWidget* @@ -133,6 +134,15 @@ gtk_pixmap_set (GtkPixmap *pixmap, } if (GTK_WIDGET_VISIBLE (pixmap)) { + /* If we aren't drawing the entire area, clear first */ + if (GTK_WIDGET_DRAWABLE (pixmap) && + ((mask != NULL) || + (GTK_WIDGET (pixmap)->requisition.width != oldwidth) || + (GTK_WIDGET (pixmap)->requisition.height != oldheight))) + { + pixmap->needs_clear = TRUE; + } + if ((GTK_WIDGET (pixmap)->requisition.width != oldwidth) || (GTK_WIDGET (pixmap)->requisition.height != oldheight)) gtk_widget_queue_resize (GTK_WIDGET (pixmap)); @@ -183,6 +193,17 @@ gtk_pixmap_expose (GtkWidget *widget, pixmap = GTK_PIXMAP (widget); misc = GTK_MISC (widget); + if (pixmap->needs_clear) + { + gdk_window_clear_area (GTK_WIDGET (pixmap)->window, + GTK_WIDGET (pixmap)->allocation.x, + GTK_WIDGET (pixmap)->allocation.y, + GTK_WIDGET (pixmap)->allocation.width, + GTK_WIDGET (pixmap)->allocation.height); + + pixmap->needs_clear = FALSE; + } + x = (widget->allocation.x * (1.0 - misc->xalign) + (widget->allocation.x + widget->allocation.width - (widget->requisition.width - misc->xpad * 2)) * diff --git a/gtk/gtkpixmap.h b/gtk/gtkpixmap.h index fbcc74c6f..a5593431d 100644 --- a/gtk/gtkpixmap.h +++ b/gtk/gtkpixmap.h @@ -46,6 +46,8 @@ struct _GtkPixmap GdkPixmap *pixmap; GdkBitmap *mask; + + guint needs_clear : 1; }; struct _GtkPixmapClass diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index 5160eca54..d7213fc4c 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -380,8 +380,6 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget, scrolled_window = GTK_SCROLLED_WINDOW (widget); widget->allocation = *allocation; - gtk_container_disable_resize (GTK_CONTAINER (scrolled_window)); - if (scrolled_window->hscrollbar_policy == GTK_POLICY_ALWAYS) scrolled_window->hscrollbar_visible = TRUE; if (scrolled_window->vscrollbar_policy == GTK_POLICY_ALWAYS) @@ -459,8 +457,6 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget, if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar)) gtk_widget_hide (scrolled_window->vscrollbar); } - - gtk_container_enable_resize (GTK_CONTAINER (scrolled_window)); } static void diff --git a/gtk/gtksignal.h b/gtk/gtksignal.h index 28a31e6a4..bc2c9c612 100644 --- a/gtk/gtksignal.h +++ b/gtk/gtksignal.h @@ -178,9 +178,9 @@ void gtk_signal_default_marshaller (GtkObject *object, void gtk_signal_set_funcs (GtkSignalMarshal marshal_func, GtkSignalDestroy destroy_func); -/* Report internal information about a signal. The caller has the response - * to invoke a supsequent g_free (returned_data); but must leave the - * contents of GtkSignalQuery untouched. +/* Report internal information about a signal. The caller has the + * responsibility to invoke a supsequent g_free (returned_data); but + * must not modify data pointed to by the members of GtkSignalQuery */ GtkSignalQuery* gtk_signal_query (guint signal_id); diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 14d683e3c..a11f37a26 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -284,6 +284,27 @@ static void move_cursor_page_ver (GtkText *text, int dir); static void move_cursor_ver (GtkText *text, int count); static void move_cursor_hor (GtkText *text, int count); +/* Binding actions */ +static void gtk_text_move_cursor (GtkEditable *editable, + gint x, + gint y); +static void gtk_text_move_word (GtkEditable *editable, + gint n); +static void gtk_text_move_page (GtkEditable *editable, + gint x, + gint y); +static void gtk_text_move_to_row (GtkEditable *editable, + gint row); +static void gtk_text_move_to_column (GtkEditable *editable, + gint row); +static void gtk_text_kill_char (GtkEditable *editable, + gint direction); +static void gtk_text_kill_word (GtkEditable *editable, + gint direction); +static void gtk_text_kill_line (GtkEditable *editable, + gint direction); + +/* To be removed */ static void gtk_text_move_forward_character (GtkText *text); static void gtk_text_move_backward_character (GtkText *text); static void gtk_text_move_forward_word (GtkText *text); @@ -363,7 +384,7 @@ static GtkTextFunction control_keys[26] = { (GtkTextFunction)gtk_text_move_beginning_of_line, /* a */ (GtkTextFunction)gtk_text_move_backward_character, /* b */ - gtk_editable_copy_clipboard, /* c */ + (GtkTextFunction)gtk_editable_copy_clipboard, /* c */ (GtkTextFunction)gtk_text_delete_forward_character, /* d */ (GtkTextFunction)gtk_text_move_end_of_line, /* e */ (GtkTextFunction)gtk_text_move_forward_character, /* f */ @@ -382,9 +403,9 @@ static GtkTextFunction control_keys[26] = NULL, /* s */ NULL, /* t */ (GtkTextFunction)gtk_text_delete_line, /* u */ - gtk_editable_paste_clipboard, /* v */ + (GtkTextFunction)gtk_editable_paste_clipboard, /* v */ (GtkTextFunction)gtk_text_delete_backward_word, /* w */ - gtk_editable_cut_clipboard, /* x */ + (GtkTextFunction)gtk_editable_cut_clipboard, /* x */ NULL, /* y */ NULL, /* z */ }; @@ -481,6 +502,17 @@ gtk_text_class_init (GtkTextClass *class) editable_class->insert_text = gtk_text_insert_text; editable_class->delete_text = gtk_text_delete_text; + + editable_class->move_cursor = gtk_text_move_cursor; + editable_class->move_word = gtk_text_move_word; + editable_class->move_page = gtk_text_move_page; + editable_class->move_to_row = gtk_text_move_to_row; + editable_class->move_to_column = gtk_text_move_to_column; + + editable_class->kill_char = gtk_text_kill_char; + editable_class->kill_word = gtk_text_kill_word; + editable_class->kill_line = gtk_text_kill_line; + editable_class->update_text = gtk_text_update_text; editable_class->get_chars = gtk_text_get_chars; editable_class->set_selection = gtk_text_set_selection; @@ -1793,11 +1825,11 @@ gtk_text_key_press (GtkWidget *widget, if (event->state & GDK_SHIFT_MASK) { extend_selection = FALSE; - gtk_editable_paste_clipboard (editable, event->time); + gtk_editable_paste_clipboard (editable); } else if (event->state & GDK_CONTROL_MASK) { - gtk_editable_copy_clipboard (editable, event->time); + gtk_editable_copy_clipboard (editable); } else { @@ -1810,7 +1842,7 @@ gtk_text_key_press (GtkWidget *widget, else if (event->state & GDK_SHIFT_MASK) { extend_selection = FALSE; - gtk_editable_cut_clipboard (editable, event->time); + gtk_editable_cut_clipboard (editable); } else gtk_text_delete_forward_character (text); @@ -3434,6 +3466,34 @@ move_cursor_hor (GtkText *text, int count) draw_cursor (text, FALSE); } +static void +gtk_text_move_cursor (GtkEditable *editable, + gint x, + gint y) +{ + if (x > 0) + { + while (x-- != 0) + move_cursor_hor (GTK_TEXT (editable), 1); + } + else if (x < 0) + { + while (x++ != 0) + move_cursor_hor (GTK_TEXT (editable), -1); + } + + if (y > 0) + { + while (y-- != 0) + move_cursor_ver (GTK_TEXT (editable), 1); + } + else if (x < 0) + { + while (y++ != 0) + move_cursor_ver (GTK_TEXT (editable), -1); + } +} + static void gtk_text_move_forward_character (GtkText *text) { @@ -3458,6 +3518,22 @@ gtk_text_move_previous_line (GtkText *text) move_cursor_ver (text, -1); } +static void +gtk_text_move_word (GtkEditable *editable, + gint n) +{ + if (n > 0) + { + while (n-- != 0) + gtk_text_move_forward_word (GTK_TEXT (editable)); + } + else if (n < 0) + { + while (n++ != 0) + gtk_text_move_backward_word (GTK_TEXT (editable)); + } +} + static void gtk_text_move_forward_word (GtkText *text) { @@ -3496,135 +3572,166 @@ gtk_text_move_backward_word (GtkText *text) draw_cursor (text, FALSE); } -static void -gtk_text_move_beginning_of_line (GtkText *text) +static void +gtk_text_move_page (GtkEditable *editable, + gint x, + gint y) { - text->cursor_virtual_x = 0; + if (y != 0) + scroll_int (GTK_TEXT (editable), + y * GTK_TEXT(editable)->vadj->page_increment); +} + +static void +gtk_text_move_to_row (GtkEditable *editable, + gint row) +{ +} + +static void +gtk_text_move_to_column (GtkEditable *editable, + gint column) +{ + GtkText *text; + + text = GTK_TEXT (editable); + + text->cursor_virtual_x = 0; /* FIXME */ undraw_cursor (text, FALSE); - + + /* Move to the beginning of the line */ while ((text->cursor_mark.index > 0) && (GTK_TEXT_INDEX (text, text->cursor_mark.index - 1) != LINE_DELIM)) decrement_mark (&text->cursor_mark); - + + while (!LAST_INDEX (text, text->cursor_mark) && + (GTK_TEXT_INDEX (text, text->cursor_mark.index) != LINE_DELIM)) + { + if (column > 0) + column--; + else if (column == 0) + break; + + advance_mark (&text->cursor_mark); + } + find_cursor (text, TRUE); draw_cursor (text, FALSE); } static void -gtk_text_move_end_of_line (GtkText *text) +gtk_text_move_beginning_of_line (GtkText *text) { - text->cursor_virtual_x = 0; + gtk_text_move_to_column (GTK_EDITABLE (text), 0); - undraw_cursor (text, FALSE); - - while (!LAST_INDEX (text, text->cursor_mark) && - (GTK_TEXT_INDEX (text, text->cursor_mark.index) != LINE_DELIM)) - advance_mark (&text->cursor_mark); - - find_cursor (text, TRUE); - draw_cursor (text, FALSE); } static void -gtk_text_delete_forward_character (GtkText *text) +gtk_text_move_end_of_line (GtkText *text) { - GtkEditable *editable; - editable = GTK_EDITABLE (text); + gtk_text_move_to_column (GTK_EDITABLE (text), -1); +} + +static void +gtk_text_kill_char (GtkEditable *editable, + gint direction) +{ + GtkText *text; + text = GTK_TEXT (editable); + if (editable->selection_start_pos != editable->selection_end_pos) gtk_editable_delete_selection (editable); else { - if (text->point.index + 1 <= TEXT_LENGTH (text)) - gtk_editable_delete_text (editable, text->point.index, text->point.index + 1); + if (direction >= 0) + { + if (text->point.index + 1 <= TEXT_LENGTH (text)) + gtk_editable_delete_text (editable, text->point.index, text->point.index + 1); + } + else + { + if (text->point.index > 0) + gtk_editable_delete_text (editable, text->point.index - 1, text->point.index); + } } } static void +gtk_text_delete_forward_character (GtkText *text) +{ + gtk_text_kill_char (GTK_EDITABLE (text), 1); +} + +static void gtk_text_delete_backward_character (GtkText *text) { - GtkEditable *editable; - editable = GTK_EDITABLE (text); + gtk_text_kill_char (GTK_EDITABLE (text), -1); +} +static void +gtk_text_kill_word (GtkEditable *editable, + gint direction) +{ if (editable->selection_start_pos != editable->selection_end_pos) gtk_editable_delete_selection (editable); else { - if (text->point.index > 0) - gtk_editable_delete_text (editable, text->point.index - 1, text->point.index); + gint old_pos = editable->current_pos; + if (direction >= 0) + { + gtk_text_move_word (editable, 1); + gtk_editable_delete_text (editable, old_pos, editable->current_pos); + } + else + { + gtk_text_move_word (editable, -1); + gtk_editable_delete_text (editable, editable->current_pos, old_pos); + } } } static void gtk_text_delete_forward_word (GtkText *text) { - guint old_pos; - - GtkEditable *editable; - editable = GTK_EDITABLE (text); - - if (editable->selection_start_pos != editable->selection_end_pos) - gtk_editable_delete_selection (editable); - else - { - old_pos = text->cursor_mark.index; - gtk_text_move_forward_word (text); - gtk_editable_delete_text (editable, old_pos, text->cursor_mark.index); - } + gtk_text_kill_word (GTK_EDITABLE (text), 1); } static void gtk_text_delete_backward_word (GtkText *text) { - gint old_pos; - - GtkEditable *editable; - editable = GTK_EDITABLE (text); + gtk_text_kill_word (GTK_EDITABLE (text), -1); +} - if (editable->selection_start_pos != editable->selection_end_pos) - gtk_editable_delete_selection (editable); +static void +gtk_text_kill_line (GtkEditable *editable, + gint direction) +{ + gint old_pos = editable->current_pos; + if (direction >= 0) + { + gtk_text_move_to_column (editable, -1); + gtk_editable_delete_text (editable, old_pos, editable->current_pos); + } else { - old_pos = text->cursor_mark.index; - gtk_text_move_backward_word (text); - gtk_editable_delete_text (editable, text->cursor_mark.index, old_pos); + gtk_text_move_to_column (editable, 0); + gtk_editable_delete_text (editable, editable->current_pos, old_pos); } } static void gtk_text_delete_line (GtkText *text) { - gint start_pos; - gint end_pos; - GtkEditable *editable = GTK_EDITABLE (text); - - gtk_text_move_beginning_of_line (text); - start_pos = text->cursor_mark.index; - - gtk_text_move_end_of_line (text); - gtk_text_move_forward_character (text); - end_pos = text->cursor_mark.index; - - gtk_editable_delete_text (editable, start_pos, end_pos); + gtk_text_move_to_column (GTK_EDITABLE (text), 0); + gtk_text_kill_line (GTK_EDITABLE (text), 1); } static void gtk_text_delete_to_line_end (GtkText *text) { - gint start_pos; - gint end_pos; - GtkEditable *editable = GTK_EDITABLE (text); - - start_pos = text->cursor_mark.index; - - gtk_text_move_end_of_line (text); - - if (start_pos == text->cursor_mark.index) - gtk_text_move_forward_character (text); - end_pos = text->cursor_mark.index; - - gtk_editable_delete_text (editable, start_pos, end_pos); + gtk_text_kill_line (GTK_EDITABLE (text), 1); } static void diff --git a/gtk/gtktypebuiltins.h b/gtk/gtktypebuiltins.h index 22c3de523..30cb80e07 100644 --- a/gtk/gtktypebuiltins.h +++ b/gtk/gtktypebuiltins.h @@ -22,6 +22,7 @@ extern GtkType GTK_TYPE_POLICY_TYPE; extern GtkType GTK_TYPE_POSITION_TYPE; extern GtkType GTK_TYPE_PREVIEW_TYPE; extern GtkType GTK_TYPE_RELIEF_STYLE; +extern GtkType GTK_TYPE_RESIZE_MODE; extern GtkType GTK_TYPE_SIGNAL_RUN_TYPE; extern GtkType GTK_TYPE_SCROLL_TYPE; extern GtkType GTK_TYPE_SELECTION_MODE; @@ -99,4 +100,4 @@ extern GtkType GTK_TYPE_GDK_WINDOW; extern GtkType GTK_TYPE_GDK_EVENT; extern GtkType GTK_TYPE_GDK_COLOR; -#define GTK_TYPE_NUM_BUILTINS (98) +#define GTK_TYPE_NUM_BUILTINS (99) diff --git a/gtk/gtktypebuiltins_evals.c b/gtk/gtktypebuiltins_evals.c index 33ee6aff6..1b1ee639f 100644 --- a/gtk/gtktypebuiltins_evals.c +++ b/gtk/gtktypebuiltins_evals.c @@ -144,6 +144,12 @@ static GtkEnumValue _gtk_relief_style_values[] = { { GTK_RELIEF_NONE, "GTK_RELIEF_NONE", "none" }, { 0, NULL, NULL } }; +static GtkEnumValue _gtk_resize_mode_values[] = { + { GTK_RESIZE_PARENT, "GTK_RESIZE_PARENT", "parent" }, + { GTK_RESIZE_QUEUE, "GTK_RESIZE_QUEUE", "queue" }, + { GTK_RESIZE_IMMEDIATE, "GTK_RESIZE_IMMEDIATE", "immediate" }, + { 0, NULL, NULL } +}; static GtkEnumValue _gtk_signal_run_type_values[] = { { GTK_RUN_FIRST, "GTK_RUN_FIRST", "first" }, { GTK_RUN_LAST, "GTK_RUN_LAST", "last" }, diff --git a/gtk/gtktypebuiltins_ids.c b/gtk/gtktypebuiltins_ids.c index 52e9e9f6e..5a5680363 100644 --- a/gtk/gtktypebuiltins_ids.c +++ b/gtk/gtktypebuiltins_ids.c @@ -44,6 +44,8 @@ GTK_TYPE_ENUM, _gtk_preview_type_values }, { "GtkReliefStyle", >K_TYPE_RELIEF_STYLE, GTK_TYPE_ENUM, _gtk_relief_style_values }, + { "GtkResizeMode", >K_TYPE_RESIZE_MODE, + GTK_TYPE_ENUM, _gtk_resize_mode_values }, { "GtkSignalRunType", >K_TYPE_SIGNAL_RUN_TYPE, GTK_TYPE_FLAGS, _gtk_signal_run_type_values }, { "GtkScrollType", >K_TYPE_SCROLL_TYPE, diff --git a/gtk/gtktypebuiltins_vars.c b/gtk/gtktypebuiltins_vars.c index c30386189..a8462b96f 100644 --- a/gtk/gtktypebuiltins_vars.c +++ b/gtk/gtktypebuiltins_vars.c @@ -22,6 +22,7 @@ GtkType GTK_TYPE_POLICY_TYPE = 0; GtkType GTK_TYPE_POSITION_TYPE = 0; GtkType GTK_TYPE_PREVIEW_TYPE = 0; GtkType GTK_TYPE_RELIEF_STYLE = 0; +GtkType GTK_TYPE_RESIZE_MODE = 0; GtkType GTK_TYPE_SIGNAL_RUN_TYPE = 0; GtkType GTK_TYPE_SCROLL_TYPE = 0; GtkType GTK_TYPE_SELECTION_MODE = 0; diff --git a/gtk/gtkviewport.c b/gtk/gtkviewport.c index c91b00d07..0d7b4f2d1 100644 --- a/gtk/gtkviewport.c +++ b/gtk/gtkviewport.c @@ -39,7 +39,7 @@ static void gtk_viewport_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_viewport_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gint gtk_viewport_need_resize (GtkContainer *container); +static void gtk_viewport_check_resize (GtkContainer *container); static void gtk_viewport_adjustment_changed (GtkAdjustment *adjustment, gpointer data); static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment, @@ -95,7 +95,7 @@ gtk_viewport_class_init (GtkViewportClass *class) widget_class->size_allocate = gtk_viewport_size_allocate; container_class->add = gtk_viewport_add; - container_class->need_resize = gtk_viewport_need_resize; + container_class->check_resize = gtk_viewport_check_resize; } static void @@ -104,6 +104,8 @@ gtk_viewport_init (GtkViewport *viewport) GTK_WIDGET_UNSET_FLAGS (viewport, GTK_NO_WINDOW); GTK_WIDGET_SET_FLAGS (viewport, GTK_BASIC); + gtk_container_set_resize_mode (GTK_CONTAINER (viewport), GTK_RESIZE_QUEUE); + viewport->shadow_type = GTK_SHADOW_IN; viewport->view_window = NULL; viewport->bin_window = NULL; @@ -630,13 +632,13 @@ gtk_viewport_size_allocate (GtkWidget *widget, } } -static gint -gtk_viewport_need_resize (GtkContainer *container) +static void +gtk_viewport_check_resize (GtkContainer *container) { GtkBin *bin; - g_return_val_if_fail (container != NULL, FALSE); - g_return_val_if_fail (GTK_IS_VIEWPORT (container), FALSE); + g_return_if_fail (container != NULL); + g_return_if_fail (GTK_IS_VIEWPORT (container)); if (GTK_WIDGET_REALIZED (container)) { @@ -647,8 +649,6 @@ gtk_viewport_need_resize (GtkContainer *container) gtk_widget_size_allocate (GTK_WIDGET (container), &(GTK_WIDGET (container)->allocation)); } - - return FALSE; } static void diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 2d20cc3e4..d1a6b8ad9 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -193,6 +193,7 @@ static GdkColormap* gtk_widget_peek_colormap (void); static GdkVisual* gtk_widget_peek_visual (void); static GtkStyle* gtk_widget_peek_style (void); +static GtkWidget* gtk_widget_get_resize_container (GtkWidget *widget); static void gtk_widget_reparent_container_child (GtkWidget *widget, gpointer client_data); static void gtk_widget_propagate_state (GtkWidget *widget, @@ -1175,11 +1176,15 @@ gtk_widget_unparent (GtkWidget *widget) /* Remove the widget and all its children from toplevel->resize_widgets */ + + toplevel = gtk_widget_get_resize_container (widget); + /* Three ways to make this prettier: * Write a g_slist_conditional_remove (GSList, gboolean (*)(gpointer)) * Change resize_widgets to a GList * Just bite the bullet and use g_slist_remove */ + tmp_list = GTK_CONTAINER (toplevel)->resize_widgets; prev_list = NULL; while (tmp_list) @@ -1606,83 +1611,86 @@ gtk_widget_queue_draw (GtkWidget *widget) static gint gtk_widget_idle_sizer (void *data) { - GSList *slist; - GSList *re_queue; - - re_queue = NULL; - while (gtk_widget_resize_queue) + GSList *slist = gtk_widget_resize_queue; + GSList *node = slist; + + gtk_widget_resize_queue = NULL; + + while (node) { - GtkWidget *widget; - - slist = gtk_widget_resize_queue; - gtk_widget_resize_queue = slist->next; - widget = slist->data; - + GtkWidget *widget = node->data; + GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING); - - gtk_widget_ref (widget); - if (gtk_container_need_resize (GTK_CONTAINER (widget))) - { - slist->next = re_queue; - re_queue = slist; - } - else - { - g_slist_free_1 (slist); - gtk_widget_unref (widget); - } - } - - for (slist = re_queue; slist; slist = slist->next) - { - GtkWidget *widget; - - widget = slist->data; - if (GTK_OBJECT (widget)->ref_count > 1 && - !GTK_OBJECT_DESTROYED (widget)) - gtk_widget_queue_resize (widget); - gtk_widget_unref (widget); + gtk_container_check_resize (GTK_CONTAINER (widget)); + + node = node->next; } - g_slist_free (re_queue); - + + g_slist_free (slist); + return FALSE; } +/* The guts here should probably be moved into gtkcontainer.c */ + void gtk_widget_queue_resize (GtkWidget *widget) { - GtkWidget *toplevel; + GtkWidget *resize_widget; + GtkContainer *container; g_return_if_fail (widget != NULL); if (GTK_OBJECT_DESTROYED (widget)) return; - - toplevel = gtk_widget_get_toplevel (widget); - if (GTK_WIDGET_TOPLEVEL (toplevel)) + + resize_widget = gtk_widget_get_resize_container (widget); + + if (resize_widget) { - if (GTK_WIDGET_VISIBLE (toplevel)) + container = GTK_CONTAINER (resize_widget); + + if (GTK_WIDGET_VISIBLE (container)) { - if (!GTK_CONTAINER_RESIZE_PENDING (toplevel)) - { - GTK_PRIVATE_SET_FLAG (toplevel, GTK_RESIZE_PENDING); - if (gtk_widget_resize_queue == NULL) - gtk_idle_add_priority (GTK_PRIORITY_INTERNAL - 1, - gtk_widget_idle_sizer, - NULL); - gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, toplevel); - } - - if (!GTK_WIDGET_RESIZE_NEEDED (widget)) + switch (container->resize_mode) { - GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED); - GTK_CONTAINER (toplevel)->resize_widgets = - g_slist_prepend (GTK_CONTAINER (toplevel)->resize_widgets, widget); + case GTK_RESIZE_QUEUE: + if (!GTK_CONTAINER_RESIZE_PENDING (container)) + { + GTK_PRIVATE_SET_FLAG (container, GTK_RESIZE_PENDING); + if (gtk_widget_resize_queue == NULL) + gtk_idle_add_priority (GTK_PRIORITY_INTERNAL - 1, + gtk_widget_idle_sizer, + NULL); + gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, container); + } + + if (!GTK_WIDGET_RESIZE_NEEDED (widget)) + { + GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED); + container->resize_widgets = + g_slist_prepend (container->resize_widgets, widget); + } + else + g_assert (g_slist_find (container->resize_widgets, widget)); /* paranoid */ + break; + + case GTK_RESIZE_IMMEDIATE: + container->resize_widgets = + g_slist_prepend (container->resize_widgets, widget); + gtk_container_check_resize (container); + case GTK_RESIZE_PARENT: + /* Ignore */ } - else - g_assert (g_slist_find (GTK_CONTAINER (toplevel)->resize_widgets, widget)); /* paranoid */ } else - gtk_container_need_resize (GTK_CONTAINER (toplevel)); + { + /* We need to let hidden toplevels know that something + * changed while they where hidden. For other resize containers, + * they will get resized when they are shown. + */ + if (GTK_WIDGET_TOPLEVEL (container)) + gtk_container_check_resize (container); + } } } @@ -3060,6 +3068,29 @@ gtk_widget_set_extension_events (GtkWidget *widget, /***************************************** + * gtk_widget_get_resize_container: + * + * arguments: + * + * results: + *****************************************/ + +static GtkWidget * +gtk_widget_get_resize_container (GtkWidget *widget) +{ + g_return_val_if_fail (widget != NULL, NULL); + + while (widget->parent) + { + widget = widget->parent; + if (GTK_CONTAINER (widget)->resize_mode != GTK_RESIZE_PARENT) + break; + } + + return GTK_IS_CONTAINER (widget) ? widget : NULL; +} + +/***************************************** * gtk_widget_get_toplevel: * * arguments: diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 6a5c89dfc..04ab0b14f 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -28,7 +28,6 @@ #include "gtkbindings.h" enum { - MOVE_RESIZE, SET_FOCUS, LAST_SIGNAL }; @@ -52,10 +51,6 @@ typedef void (*GtkWindowSignal2) (GtkObject *object, gpointer arg1, gpointer data); -static void gtk_window_marshal_signal_1 (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args); static void gtk_window_marshal_signal_2 (GtkObject *object, GtkSignalFunc func, gpointer func_data, @@ -97,15 +92,10 @@ static gint gtk_window_focus_out_event (GtkWidget *widget, GdkEventFocus *event); static gint gtk_window_client_event (GtkWidget *widget, GdkEventClient *event); -static gint gtk_window_need_resize (GtkContainer *container); -static gint gtk_real_window_move_resize (GtkWindow *window, - gint *x, - gint *y, - gint width, - gint height); +static void gtk_window_check_resize (GtkContainer *container); static void gtk_real_window_set_focus (GtkWindow *window, GtkWidget *focus); -static gint gtk_window_move_resize (GtkWidget *widget); +static void gtk_window_move_resize (GtkWindow *window); static void gtk_window_set_hints (GtkWidget *widget, GtkRequisition *requisition); @@ -161,16 +151,6 @@ gtk_window_class_init (GtkWindowClass *klass) gtk_object_add_arg_type ("GtkWindow::allow_grow", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_GROW); gtk_object_add_arg_type ("GtkWindow::window_position", GTK_TYPE_WINDOW_POSITION, GTK_ARG_READWRITE, ARG_WIN_POS); - window_signals[MOVE_RESIZE] = - gtk_signal_new ("move_resize", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (GtkWindowClass, move_resize), - gtk_window_marshal_signal_1, - GTK_TYPE_BOOL, 4, - GTK_TYPE_POINTER, GTK_TYPE_POINTER, - GTK_TYPE_INT, GTK_TYPE_INT); - window_signals[SET_FOCUS] = gtk_signal_new ("set_focus", GTK_RUN_LAST, @@ -202,9 +182,8 @@ gtk_window_class_init (GtkWindowClass *klass) widget_class->focus_out_event = gtk_window_focus_out_event; widget_class->client_event = gtk_window_client_event; - container_class->need_resize = gtk_window_need_resize; + container_class->check_resize = gtk_window_check_resize; - klass->move_resize = gtk_real_window_move_resize; klass->set_focus = gtk_real_window_set_focus; } @@ -221,7 +200,6 @@ gtk_window_init (GtkWindow *window) window->focus_widget = NULL; window->default_widget = NULL; window->resize_count = 0; - window->need_resize = FALSE; window->allow_shrink = FALSE; window->allow_grow = TRUE; window->auto_shrink = FALSE; @@ -229,6 +207,7 @@ gtk_window_init (GtkWindow *window) window->position = GTK_WIN_POS_NONE; window->use_uposition = TRUE; + gtk_container_set_resize_mode (GTK_CONTAINER (window), GTK_RESIZE_QUEUE); gtk_container_register_toplevel (GTK_CONTAINER (window)); } @@ -455,26 +434,6 @@ gtk_window_activate_default (GtkWindow *window) } static void -gtk_window_marshal_signal_1 (GtkObject *object, - GtkSignalFunc func, - gpointer func_data, - GtkArg *args) -{ - GtkWindowSignal1 rfunc; - gint *return_val; - - rfunc = (GtkWindowSignal1) func; - return_val = GTK_RETLOC_BOOL (args[4]); - - *return_val = (* rfunc) (object, - GTK_VALUE_POINTER (args[0]), - GTK_VALUE_POINTER (args[1]), - GTK_VALUE_INT (args[2]), - GTK_VALUE_INT (args[3]), - func_data); -} - -static void gtk_window_marshal_signal_2 (GtkObject *object, GtkSignalFunc func, gpointer func_data, @@ -522,7 +481,7 @@ gtk_window_show (GtkWidget *widget) g_return_if_fail (GTK_IS_WINDOW (widget)); GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE); - gtk_container_need_resize (GTK_CONTAINER (widget)); + gtk_container_check_resize (GTK_CONTAINER (widget)); gtk_widget_map (widget); } @@ -650,7 +609,7 @@ gtk_window_size_request (GtkWidget *widget, else { if (!GTK_WIDGET_VISIBLE (window)) - window->need_resize = TRUE; + GTK_CONTAINER (window)->need_resize = TRUE; } } @@ -973,47 +932,92 @@ gtk_window_client_event (GtkWidget *widget, return FALSE; } -static gint -gtk_window_need_resize (GtkContainer *container) +static void +gtk_window_check_resize (GtkContainer *container) { GtkWindow *window; - gint return_val; - - g_return_val_if_fail (container != NULL, FALSE); - g_return_val_if_fail (GTK_IS_WINDOW (container), FALSE); - return_val = FALSE; + g_return_if_fail (container != NULL); + g_return_if_fail (GTK_IS_WINDOW (container)); window = GTK_WINDOW (container); - if (window->handling_resize) - return return_val; - - if (GTK_WIDGET_VISIBLE (container)) - return_val = gtk_window_move_resize (GTK_WIDGET (window)); - else - window->need_resize = TRUE; - - return return_val; + if (!window->handling_resize) + { + if (GTK_WIDGET_VISIBLE (container)) + gtk_window_move_resize (window); + else + GTK_CONTAINER (window)->need_resize = TRUE; + } } -static gint -gtk_real_window_move_resize (GtkWindow *window, - gint *x, - gint *y, - gint width, - gint height) +/* FIXME: we leave container->resize_widgets set under some + circumstances ? */ +static void +gtk_window_move_resize (GtkWindow *window) { - GtkWidget *widget; + GtkWidget *widget; + GtkContainer *container; + gint x, y; + gint width, height; + gint screen_width; + gint screen_height; gboolean needed_resize; - - g_return_val_if_fail (window != NULL, FALSE); - g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE); - g_return_val_if_fail ((x != NULL) || (y != NULL), FALSE); + + g_return_if_fail (window != NULL); + g_return_if_fail (GTK_IS_WINDOW (window)); widget = GTK_WIDGET (window); + container = GTK_CONTAINER (widget); + + /* Remember old size, to know if we have to reset hints */ + width = widget->requisition.width; + height = widget->requisition.height; + gtk_widget_size_request (widget, &widget->requisition); + + if ((width != widget->requisition.width || + height != widget->requisition.height)) + gtk_window_set_hints (widget, &widget->requisition); + + x = -1; + y = -1; + width = widget->requisition.width; + height = widget->requisition.height; + + if (window->use_uposition) + switch (window->position) + { + case GTK_WIN_POS_CENTER: + x = (gdk_screen_width () - width) / 2; + y = (gdk_screen_height () - height) / 2; + gtk_widget_set_uposition (widget, x, y); + break; + case GTK_WIN_POS_MOUSE: + gdk_window_get_pointer (NULL, &x, &y, NULL); + + x -= width / 2; + y -= height / 2; + + screen_width = gdk_screen_width (); + screen_height = gdk_screen_height (); + + if (x < 0) + x = 0; + else if (x > (screen_width - width)) + x = screen_width - width; + + if (y < 0) + y = 0; + else if (y > (screen_height - height)) + y = screen_height - height; + + gtk_widget_set_uposition (widget, x, y); + break; + } - needed_resize = window->need_resize; - window->need_resize = FALSE; + /* Now, do the resizing */ + + needed_resize = container->need_resize; + container->need_resize = FALSE; if ((widget->requisition.width == 0) || (widget->requisition.height == 0)) @@ -1033,7 +1037,7 @@ gtk_real_window_move_resize (GtkWindow *window, gtk_widget_size_allocate (widget, &allocation); - return FALSE; + return; } gdk_window_get_geometry (widget->window, NULL, NULL, &width, &height, NULL); @@ -1045,8 +1049,8 @@ gtk_real_window_move_resize (GtkWindow *window, (height < widget->requisition.height)) { window->resize_count += 1; - if ((*x != -1) && (*y != -1)) - gdk_window_move_resize (widget->window, *x, *y, + if ((x != -1) && (y != -1)) + gdk_window_move_resize (widget->window, x, y, widget->requisition.width, widget->requisition.height); else @@ -1068,161 +1072,15 @@ gtk_real_window_move_resize (GtkWindow *window, allocation.height = widget->requisition.height; gtk_widget_size_allocate (widget, &allocation); + gtk_container_clear_resize_widgets (GTK_CONTAINER (window)); } else { - /* The window hasn't changed size but one of its children - * queued a resize request. Which means that the allocation - * is not sufficient for the requisition of some child. - * We've already performed a size request at this point, - * so we simply need to run through the list of resize - * widgets and reallocate their sizes appropriately. We - * make the optimization of not performing reallocation - * for a widget who also has a parent in the resize widgets - * list. GTK_RESIZE_NEEDED is used for flagging those - * parents inside this function. - */ - GSList *resize_widgets; - GSList *resize_containers; - GSList *node; - - if ((*x != -1) && (*y != -1)) - gdk_window_move (widget->window, *x, *y); + if ((x != -1) && (y != -1)) + gdk_window_move (widget->window, x, y); - resize_widgets = GTK_CONTAINER (window)->resize_widgets; - GTK_CONTAINER (window)->resize_widgets = NULL; - - for (node = resize_widgets; node; node = node->next) - { - widget = node->data; - - GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED); - - while (widget && widget->parent && - ((widget->allocation.width < widget->requisition.width) || - (widget->allocation.height < widget->requisition.height))) - widget = widget->parent; - - GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED); - node->data = widget; - } - - resize_containers = NULL; - - for (node = resize_widgets; node; node = node->next) - { - GtkWidget *resize_container; - - widget = node->data; - - if (!GTK_WIDGET_RESIZE_NEEDED (widget)) - continue; - - resize_container = widget->parent; - - if (resize_container) - { - GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED); - widget = resize_container->parent; - - while (widget) - { - if (GTK_WIDGET_RESIZE_NEEDED (widget)) - { - GTK_PRIVATE_UNSET_FLAG (resize_container, GTK_RESIZE_NEEDED); - resize_container = widget; - } - widget = widget->parent; - } - } - else - resize_container = widget; - - if (!g_slist_find (resize_containers, resize_container)) - resize_containers = g_slist_prepend (resize_containers, - resize_container); - } - g_slist_free (resize_widgets); - - for (node = resize_containers; node; node = node->next) - { - widget = node->data; - - GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED); - gtk_widget_size_allocate (widget, &widget->allocation); - gtk_widget_queue_draw (widget); - } - g_slist_free (resize_containers); + gtk_container_resize_children (GTK_CONTAINER (window)); } - - return FALSE; -} - -static gint -gtk_window_move_resize (GtkWidget *widget) -{ - GtkWindow *window; - gint x, y; - gint width, height; - gint screen_width; - gint screen_height; - gint return_val; - - g_return_val_if_fail (widget != NULL, FALSE); - g_return_val_if_fail (GTK_IS_WINDOW (widget), FALSE); - - window = GTK_WINDOW (widget); - return_val = FALSE; - - /* Remember old size, to know if we have to reset hints */ - width = widget->requisition.width; - height = widget->requisition.height; - gtk_widget_size_request (widget, &widget->requisition); - - if ((width != widget->requisition.width || - height != widget->requisition.height)) - gtk_window_set_hints (widget, &widget->requisition); - - x = -1; - y = -1; - width = widget->requisition.width; - height = widget->requisition.height; - - if (window->use_uposition) - switch (window->position) - { - case GTK_WIN_POS_CENTER: - x = (gdk_screen_width () - width) / 2; - y = (gdk_screen_height () - height) / 2; - gtk_widget_set_uposition (widget, x, y); - break; - case GTK_WIN_POS_MOUSE: - gdk_window_get_pointer (NULL, &x, &y, NULL); - - x -= width / 2; - y -= height / 2; - - screen_width = gdk_screen_width (); - screen_height = gdk_screen_height (); - - if (x < 0) - x = 0; - else if (x > (screen_width - width)) - x = screen_width - width; - - if (y < 0) - y = 0; - else if (y > (screen_height - height)) - y = screen_height - height; - - gtk_widget_set_uposition (widget, x, y); - break; - } - - gtk_signal_emit (GTK_OBJECT (widget), window_signals[MOVE_RESIZE], - &x, &y, width, height, &return_val); - - return return_val; } static void diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h index e8d3dc02b..ce73469f5 100644 --- a/gtk/gtkwindow.h +++ b/gtk/gtkwindow.h @@ -55,7 +55,6 @@ struct _GtkWindow GtkWidget *default_widget; gushort resize_count; - guint need_resize : 1; guint allow_shrink : 1; guint allow_grow : 1; guint auto_shrink : 1; @@ -68,11 +67,6 @@ struct _GtkWindowClass { GtkBinClass parent_class; - gint (* move_resize) (GtkWindow *window, - gint *x, - gint *y, - gint width, - gint height); void (* set_focus) (GtkWindow *window, GtkWidget *focus); }; diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 3288d2887..2a98c46db 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -4428,10 +4428,10 @@ create_file_selection (void) } void -font_selection_ok (GtkWidget *w, - GtkFontSelection *fs) +font_selection_ok (GtkWidget *w, + GtkFontSelectionDialog *fs) { - g_print ("%s\n", gtk_font_selection_get_font_name (fs)); + g_print ("%s\n", gtk_font_selection_dialog_get_font_name (fs)); gtk_widget_destroy (GTK_WIDGET (fs)); } @@ -4452,7 +4452,7 @@ create_font_selection (void) gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button), "clicked", GTK_SIGNAL_FUNC(font_selection_ok), - GTK_FONT_SELECTION_DIALOG (window)->fontsel); + GTK_FONT_SELECTION_DIALOG (window)); gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT (window)); diff --git a/gtk/testthreads.c b/gtk/testthreads.c index 71d761bde..71527d13d 100644 --- a/gtk/testthreads.c +++ b/gtk/testthreads.c @@ -19,9 +19,10 @@ #include <stdio.h> #include <gtk/gtk.h> #include "../config.h" -#include <pthread.h> #ifdef USE_PTHREADS +#include <pthread.h> + static int nthreads = 0; static pthread_mutex_t nthreads_mutex = PTHREAD_MUTEX_INITIALIZER; diff --git a/tests/testgtk.c b/tests/testgtk.c index 3288d2887..2a98c46db 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -4428,10 +4428,10 @@ create_file_selection (void) } void -font_selection_ok (GtkWidget *w, - GtkFontSelection *fs) +font_selection_ok (GtkWidget *w, + GtkFontSelectionDialog *fs) { - g_print ("%s\n", gtk_font_selection_get_font_name (fs)); + g_print ("%s\n", gtk_font_selection_dialog_get_font_name (fs)); gtk_widget_destroy (GTK_WIDGET (fs)); } @@ -4452,7 +4452,7 @@ create_font_selection (void) gtk_signal_connect (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->ok_button), "clicked", GTK_SIGNAL_FUNC(font_selection_ok), - GTK_FONT_SELECTION_DIALOG (window)->fontsel); + GTK_FONT_SELECTION_DIALOG (window)); gtk_signal_connect_object (GTK_OBJECT (GTK_FONT_SELECTION_DIALOG (window)->cancel_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT (window)); diff --git a/tests/testthreads.c b/tests/testthreads.c index 71d761bde..71527d13d 100644 --- a/tests/testthreads.c +++ b/tests/testthreads.c @@ -19,9 +19,10 @@ #include <stdio.h> #include <gtk/gtk.h> #include "../config.h" -#include <pthread.h> #ifdef USE_PTHREADS +#include <pthread.h> + static int nthreads = 0; static pthread_mutex_t nthreads_mutex = PTHREAD_MUTEX_INITIALIZER; |