1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
window2();
/*
//gtk_button_set_focus_on_click(, gpointer);
char *display_name = getenv("DISPLAY");
Display *dpy;
Window root;
long mask;
XEvent event;
dpy = XOpenDisplay(display_name);
*/
}
void window2 (GtkWidget *wid, GtkWidget *win)
{
gint x, y, xadd=0, yadd=0;
GdkDisplay *display = NULL;
GdkScreen *screen = NULL;
/* get default display and screen */
display = gdk_display_get_default ();
screen = gdk_display_get_default_screen (display);
x=36; y=82;
printf("b\n");
gdk_display_warp_pointer (display, screen, x, y);
gdk_display_pointer_ungrab(display, 10);
usleep(1*(1000*1000));
window3();
}
void window3(GtkWidget *wid, GtkWidget *win)
{
gint x, y, xadd=0, yadd=0;
GdkDisplay *display = NULL;
GdkScreen *screen = NULL;
GtkWidget *widget = NULL;
/* get default display and screen */
display = gdk_display_get_default ();
screen = gdk_display_get_default_screen (display);
x=36; y=7;
printf("c\n");
gdk_display_warp_pointer (display, screen, x, y);
gdk_display_pointer_ungrab(display, 10);
usleep(5*(1000*1000));
//window4();
}
int main (int argc, char *argv[])
{
GtkWidget *button = NULL;
GtkWidget *win = NULL;
GtkWidget *vbox = NULL;
/* Initialize GTK+ */
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL);
gtk_init (&argc, &argv);
g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL);
/* Create the main window */
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width (GTK_CONTAINER (win), 8);
gtk_window_set_title (GTK_WINDOW (win), "Hello World");
gtk_window_set_position (GTK_WINDOW (win), GTK_WIN_POS_CENTER);
gtk_widget_realize (win);
g_signal_connect (win, "destroy", gtk_main_quit, NULL);
/* Create a vertical box with buttons */
vbox = gtk_vbox_new (TRUE, 6);
gtk_container_add (GTK_CONTAINER (win), vbox);
button = gtk_button_new_from_stock (GTK_STOCK_DIALOG_INFO);
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (helloWorld), (gpointer) win);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
button = gtk_button_new_from_stock ("Tıkla");
g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (window1), (gpointer) win);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
g_signal_connect (button, "clicked", gtk_main_quit, NULL);
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
/* Enter the main loop */
gtk_widget_show_all (win);
gtk_main ();
return 0;
}
|