Last active
August 29, 2015 14:23
-
-
Save Lekensteyn/fac9cb6df745bdb680c1 to your computer and use it in GitHub Desktop.
Minimal reproducer for gtk3/mutter bug https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3961
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <gtk/gtk.h> | |
#include <gdk/gdk.h> | |
#include <stdlib.h> | |
static void | |
activate (GtkApplication* app, | |
gpointer user_data) | |
{ | |
(void)user_data; | |
GdkScreen *screen; | |
GtkWidget *window; | |
GtkWidget *button; | |
GtkWidget *button_box; | |
GdkRectangle viewable_area = { 0 }; | |
int x; | |
int width; | |
int height; | |
screen = gdk_screen_get_default (); | |
if (!screen) { | |
abort(); | |
} | |
/* Hard-coded for second screen! */ | |
gdk_screen_get_monitor_geometry (screen, 1, &viewable_area); | |
x = viewable_area.x; | |
width = viewable_area.width; | |
height = viewable_area.height; | |
printf("x=%d width=%d height=%d\n", x, width, height); | |
window = gtk_application_window_new (app); | |
gtk_window_set_title (GTK_WINDOW (window), "Window"); | |
gtk_window_move (GTK_WINDOW (window), x, 0); | |
gtk_window_set_default_size (GTK_WINDOW (window), width, height); | |
button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); | |
gtk_widget_set_valign (button_box, GTK_ALIGN_START); | |
gtk_container_add (GTK_CONTAINER (window), button_box); | |
button = gtk_button_new_with_label ("Hello World"); | |
gtk_container_add (GTK_CONTAINER (button_box), button); | |
gtk_widget_show_all (window); | |
} | |
int | |
main (int argc, | |
char **argv) | |
{ | |
GtkApplication *app; | |
int status; | |
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE); | |
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL); | |
status = g_application_run (G_APPLICATION (app), argc, argv); | |
g_object_unref (app); | |
return status; | |
} | |
/* vim: set sw=2 ts=2 et: */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CFLAGS = -Wall -Wextra -g $(shell pkg-config --cflags gtk+-3.0) | |
LDFLAGS = $(shell pkg-config --libs gtk+-3.0) | |
app: app.c | |
$(CC) $(CFLAGS) $< -o $@ $(LDFLAGS) |
rbalint
commented
Jun 25, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment