From e092956d3a22d415ab0b1b1b3f47464e5bed9caa Mon Sep 17 00:00:00 2001 From: daleclack Date: Thu, 11 Feb 2021 08:56:47 +0800 Subject: [PATCH] Update gtk41 --- Gtk3/gtk41/res/window.ui | 10 +++++++++- Gtk3/gtk41/res/window.ui~ | 11 ++++++++++- Gtk3/gtk41/src/main.cpp | 9 +++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Gtk3/gtk41/res/window.ui b/Gtk3/gtk41/res/window.ui index 1483ba4..56d5c07 100644 --- a/Gtk3/gtk41/res/window.ui +++ b/Gtk3/gtk41/res/window.ui @@ -33,7 +33,15 @@ True close,minimize,maximize:icon - + + Win size + True + True + True + + + end + diff --git a/Gtk3/gtk41/res/window.ui~ b/Gtk3/gtk41/res/window.ui~ index 5f40ab7..1483ba4 100644 --- a/Gtk3/gtk41/res/window.ui~ +++ b/Gtk3/gtk41/res/window.ui~ @@ -26,7 +26,16 @@ - + + True + False + gtk41 + True + close,minimize,maximize:icon + + + + diff --git a/Gtk3/gtk41/src/main.cpp b/Gtk3/gtk41/src/main.cpp index 92ee4b8..ba64b30 100644 --- a/Gtk3/gtk41/src/main.cpp +++ b/Gtk3/gtk41/src/main.cpp @@ -1,6 +1,12 @@ #include #include "res/winpe.xpm" +void get_winsize(GtkWidget *widget,GtkWindow *window){ + gint width,height; + gtk_window_get_size(window,&width,&height); + g_print("%d %d\n",width,height); +} + gboolean window_resize(GtkWidget *widget,GdkEvent *event,GtkBuilder *builder){ //Get window size gint width,height; @@ -22,6 +28,9 @@ static void gtkmain(GtkApplication *app,gpointer user_data){ GtkBuilder *builder=gtk_builder_new_from_file("res/window.ui"); GObject *window=gtk_builder_get_object(builder,"window"); gtk_application_add_window(app,GTK_WINDOW(window)); + //Get window size + GObject *btnsize=gtk_builder_get_object(builder,"btnsize"); + g_signal_connect(btnsize,"clicked",G_CALLBACK(get_winsize),window); gtk_widget_show_all(GTK_WIDGET(window)); g_signal_connect(window,"window-state-event",G_CALLBACK(window_resize),builder); }