We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <glib/gi18n.h> #include <gtk/gtk.h>
GtkWidget *m_pwidget; GtkWidget *win;
void quit() { if(m_pwidget) { gtk_widget_destroy(m_pwidget); g_object_unref(m_pwidget); gtk_main_quit(); } }
void windows() { m_pwidget = gtk_window_new(GTK_WINDOW_TOPLEVEL); g_object_ref(m_pwidget); g_signal_connect(m_pwidget, "destroy" , G_CALLBACK(quit), NULL);
GtkWidget *m_mainWidget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_can_focus(m_mainWidget, false);
GtkTextBuffer *m_buffer = gtk_text_buffer_new(NULL); GtkWidget *m_text = gtk_text_view_new_with_buffer(m_buffer);
gtk_box_pack_start(GTK_BOX(m_mainWidget),m_text,true,true,10); gtk_widget_set_size_request(m_text,20,15);
gtk_container_add(GTK_CONTAINER(m_pwidget), m_mainWidget);
gtk_widget_show(m_mainWidget);
GdkScreen *screen = gdk_screen_get_default(); gint screen_w = gdk_screen_get_width(screen); gint screen_h = gdk_screen_get_height(screen); gtk_widget_set_size_request(m_pwidget, screen_w/6, screen_h/6); // 设置窗口的最小大小 gtk_window_move(GTK_WINDOW(m_pwidget), (screen_w - (screen_w/6)-50), (screen_h - (screen_h/6)));
gtk_widget_show(m_pwidget); gtk_main(); }
void testwindow() { GtkWidget *btn=NULL,*m_wxwindow =NULL,wbtn = NULL; / New a window and a button */ win = gtk_window_new(GTK_WINDOW_TOPLEVEL); btn = gtk_button_new_with_label("Close yourself");
gtk_container_add(GTK_CONTAINER(win), btn); g_signal_connect(win, "destroy" , G_CALLBACK(gtk_main_quit), NULL); g_signal_connect(btn, "clicked" , G_CALLBACK(windows), NULL);
GdkScreen screen = gdk_screen_get_default(); gint screen_w = gdk_screen_get_width(screen); gint screen_h = gdk_screen_get_height(screen); gtk_widget_set_size_request(win, screen_w/6, screen_h/6); // 设置窗口的最小大小 gtk_window_move(GTK_WINDOW(win), (screen_w - (screen_w/6i)-50), (screen_h - (screen_h/6*i)));
gtk_widget_show_all(win);
gtk_main();
}
int main(int argc, char *argv[]) {
gtk_init( &argc, &argv); testwindow(); return 0 ;
If you repeatedly open the jump interface above, you will find that the memory keeps increasing
The text was updated successfully, but these errors were encountered:
No branches or pull requests
#include <glib/gi18n.h>
#include <gtk/gtk.h>
GtkWidget *m_pwidget;
GtkWidget *win;
void quit()
{
if(m_pwidget)
{
gtk_widget_destroy(m_pwidget);
g_object_unref(m_pwidget);
gtk_main_quit();
}
}
void windows()
{
m_pwidget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_object_ref(m_pwidget);
g_signal_connect(m_pwidget, "destroy" , G_CALLBACK(quit), NULL);
GtkWidget *m_mainWidget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
GtkTextBuffer *m_buffer = gtk_text_buffer_new(NULL);
GtkWidget *m_text = gtk_text_view_new_with_buffer(m_buffer);
gtk_box_pack_start(GTK_BOX(m_mainWidget),m_text,true,true,10);
gtk_widget_set_size_request(m_text,20,15);
gtk_widget_show(m_mainWidget);
GdkScreen *screen = gdk_screen_get_default();
gint screen_w = gdk_screen_get_width(screen);
gint screen_h = gdk_screen_get_height(screen);
gtk_widget_set_size_request(m_pwidget, screen_w/6, screen_h/6); // 设置窗口的最小大小
gtk_window_move(GTK_WINDOW(m_pwidget), (screen_w - (screen_w/6)-50), (screen_h - (screen_h/6)));
gtk_widget_show(m_pwidget);
gtk_main();
}
void testwindow()
{
GtkWidget *btn=NULL,*m_wxwindow =NULL,wbtn = NULL;
/ New a window and a button */
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
btn = gtk_button_new_with_label("Close yourself");
GdkScreen screen = gdk_screen_get_default();
gint screen_w = gdk_screen_get_width(screen);
gint screen_h = gdk_screen_get_height(screen);
gtk_widget_set_size_request(win, screen_w/6, screen_h/6); // 设置窗口的最小大小
gtk_window_move(GTK_WINDOW(win), (screen_w - (screen_w/6i)-50), (screen_h - (screen_h/6*i)));
gtk_main();
}
int main(int argc, char *argv[])
{
}
If you repeatedly open the jump interface above, you will find that the memory keeps increasing
The text was updated successfully, but these errors were encountered: