summaryrefslogtreecommitdiff
path: root/gtk/gtkwindow.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1998-08-11 19:06:18 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-08-11 19:06:18 +0000
commitca7082a04ac2305c354e1b2cdbe1468ba8749413 (patch)
tree940fab03cb31813d0b7ce295a3e871b20e4310bf /gtk/gtkwindow.c
parentb46f089b6f4c1f0dbcb490b22e982ddbcea3627d (diff)
downloadgtk+-ca7082a04ac2305c354e1b2cdbe1468ba8749413.tar.gz
Removed has_cursor, set the cursor beginning of Text when creating the
Tue Aug 11 15:04:52 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtktext.[ch]: Removed has_cursor, set the cursor beginning of Text when creating the Text widget. * gtk/testgtk.c: Grab the focus on the text widget so as to test out the above. Tue Aug 11 14:55:00 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtkeditable.c: Reverted part of timj's change of Jul 16. ::changed is a notification signal and should have no default handler. A complete redraw of the Text widget does _not_ need to be done on every text insertion. Tue Aug 11 13:07:29 1998 Owen Taylor <otaylor@redhat.com> (gtk-abilleira-072198-patch) * gtk/gtkwindow.[ch]: Add gtk_window_set_modal() which sets a flag; when set the window does a gtk_grab_add() when the window is shown, and a gtk_grab_remove() when the window is hidden. * gtk/gtkfilesel.[ch]: Test if it is running in modal form and in that case will run "Create Dir","Delete File" and "Rename File" dialogs as modal too. * gtk/testgtk.c: Added a button with an example of creating modal dialog boxes. Including file selection and color selection standard dialogs. Tue Aug 11 00:44:47 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtkhscrollbar.c gtk/gtkvscrollbar.c gtk/gtktoolbar.c: Removed CAN_FOCUS by default from scrollbars, button children of toolbar. (But not GDK_TOOLBAR_CHILD_WIDGET children) (Scrollbar definitely good change, toolbar bit more questionable)
Diffstat (limited to 'gtk/gtkwindow.c')
-rw-r--r--gtk/gtkwindow.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index fd5ba6c53a..bf26932091 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -26,6 +26,7 @@
#include "gtksignal.h"
#include "gtkwindow.h"
#include "gtkbindings.h"
+#include "gtkmain.h"
enum {
SET_FOCUS,
@@ -199,6 +200,7 @@ gtk_window_init (GtkWindow *window)
window->handling_resize = FALSE;
window->position = GTK_WIN_POS_NONE;
window->use_uposition = TRUE;
+ window->modal = FALSE;
gtk_container_register_toplevel (GTK_CONTAINER (window));
}
@@ -433,6 +435,24 @@ gtk_window_activate_default (GtkWindow *window)
return FALSE;
}
+void
+gtk_window_set_modal (GtkWindow *window, gboolean modal)
+{
+ g_return_if_fail (window != NULL);
+ g_return_if_fail (GTK_IS_WINDOW (window));
+
+ /* If the widget was showed already, adjust it's grab state */
+ if (GTK_WIDGET_VISIBLE(GTK_WIDGET(window)))
+ {
+ if (window->modal && !modal)
+ gtk_grab_remove (GTK_WIDGET(window));
+ else if (!window->modal && modal)
+ gtk_grab_add (GTK_WIDGET(window));
+ }
+
+ window->modal = modal;
+}
+
static void
gtk_window_shutdown (GtkObject *object)
{
@@ -485,6 +505,10 @@ gtk_window_show (GtkWidget *widget)
GTK_WIDGET_SET_FLAGS (widget, GTK_VISIBLE);
gtk_container_check_resize (GTK_CONTAINER (widget));
gtk_widget_map (widget);
+
+ if (GTK_WINDOW(widget)->modal)
+ gtk_grab_add(widget);
+
}
static void
@@ -495,6 +519,10 @@ gtk_window_hide (GtkWidget *widget)
GTK_WIDGET_UNSET_FLAGS (widget, GTK_VISIBLE);
gtk_widget_unmap (widget);
+
+ if (GTK_WINDOW(widget)->modal)
+ gtk_grab_remove(widget);
+
}
static void