Make the initial text size the same as normal text
[darcs-mirror-screen-message.debian.git] / sm.c
diff --git a/sm.c b/sm.c
index b1c07c8..924ec2c 100644 (file)
--- a/sm.c
+++ b/sm.c
@@ -47,7 +47,10 @@ static void realize(GtkWindow *window, GdkScreen *screen, gpointer data) {
 }
 
 static void clear_text(GtkAccelGroup *accel, GObject *window, guint keyval,  GdkModifierType modifier) {
-       gtk_text_buffer_set_text(tb,"",-1);
+       if( gtk_text_buffer_get_char_count(tb) )
+               gtk_text_buffer_set_text(tb,"",-1);
+       else
+               gtk_main_quit();
 }
 
 static char *get_text() {
@@ -130,6 +133,10 @@ int main(int argc, char **argv) {
 
        window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
        gtk_window_set_decorated(GTK_WINDOW(window), FALSE);
+       gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
+       GdkScreen *screen = gtk_window_get_screen(GTK_WINDOW(window));
+       gtk_widget_set_size_request(window, gdk_screen_get_width(screen),
+                                           gdk_screen_get_height(screen));
        gtk_window_fullscreen(GTK_WINDOW(window));
        g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
 
@@ -225,5 +232,7 @@ int main(int argc, char **argv) {
        g_signal_connect(G_OBJECT(draw), "expose-event", G_CALLBACK(redraw), NULL);
        g_signal_connect(G_OBJECT(tb), "changed", G_CALLBACK(newtext), NULL);
 
+       resize();
+
        gtk_main();
 }