forked from AuroraMiddleware/gtk
Add a gtk_window_close function
This is useful when adding close buttons in custom titlebars.
This commit is contained in:
parent
860197a7d2
commit
c73b48f28a
@ -5560,6 +5560,7 @@ gtk_window_get_default_widget
|
||||
gtk_window_set_default
|
||||
gtk_window_present
|
||||
gtk_window_present_with_time
|
||||
gtk_window_close
|
||||
gtk_window_iconify
|
||||
gtk_window_deiconify
|
||||
gtk_window_stick
|
||||
|
@ -1235,7 +1235,7 @@ gtk_window_title_max_clicked (GtkWidget *widget, gpointer data)
|
||||
static gboolean
|
||||
send_delete_event (gpointer data)
|
||||
{
|
||||
GtkWidget *window = GTK_WIDGET (data);
|
||||
GtkWidget *window = data;
|
||||
GdkEvent *event;
|
||||
|
||||
event = gdk_event_new (GDK_DELETE);
|
||||
@ -1249,10 +1249,25 @@ send_delete_event (gpointer data)
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_window_title_close_clicked (GtkWidget *button, gpointer data)
|
||||
/**
|
||||
* gtk_window_close:
|
||||
* @window: a #GtkWindow
|
||||
*
|
||||
* Requests that the window is closed, similar to what happens
|
||||
* when a window manager close button is clicked.
|
||||
*
|
||||
* This function can be used with close buttons in custom
|
||||
* titlebars.
|
||||
*
|
||||
* Since: 3.10
|
||||
*/
|
||||
void
|
||||
gtk_window_close (GtkWindow *window)
|
||||
{
|
||||
gdk_threads_add_idle (send_delete_event, data);
|
||||
if (!gtk_widget_get_realized (GTK_WIDGET (window)))
|
||||
return;
|
||||
|
||||
gdk_threads_add_idle (send_delete_event, window);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -5157,7 +5172,7 @@ update_window_buttons (GtkWindow *window)
|
||||
gtk_widget_set_can_focus (button, FALSE);
|
||||
gtk_widget_show_all (button);
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (gtk_window_title_close_clicked), window);
|
||||
G_CALLBACK (gtk_window_close), window);
|
||||
priv->title_close_button = button;
|
||||
}
|
||||
|
||||
|
@ -348,6 +348,8 @@ GDK_AVAILABLE_IN_ALL
|
||||
void gtk_window_fullscreen (GtkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_window_unfullscreen (GtkWindow *window);
|
||||
GDK_AVAILABLE_IN_3_10
|
||||
void gtk_window_close (GtkWindow *window);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_window_set_keep_above (GtkWindow *window, gboolean setting);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
Loading…
Reference in New Issue
Block a user