From: Enlightenment C. <no...@cv...> - 2006-04-03 20:23:34
|
Enlightenment CVS committal Author : ningerso Project : e17 Module : proto Dir : e17/proto/empower/src/bin Modified Files: empower.c Log Message: Center the window without using an override window. =================================================================== RCS file: /cvs/e/e17/proto/empower/src/bin/empower.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- empower.c 3 Apr 2006 16:44:38 -0000 1.2 +++ empower.c 3 Apr 2006 20:23:19 -0000 1.3 @@ -10,12 +10,19 @@ Ewl_Widget *win = NULL; char password[1024]; +int xpos, ypos; + void destroy_cb(Ewl_Widget *w, void *event, void *data) { ewl_widget_destroy(win); ewl_main_quit(); } +void reveal_cb(Ewl_Widget *w, void *event, void *data) +{ + ewl_window_move(EWL_WINDOW(win), xpos, ypos); +} + void pipe_to_sudo(Ewl_Widget *w, void *event, void *data) { snprintf(password, 1024, "%s", (char*)(ewl_password_text_get(EWL_PASSWORD(data)))); @@ -90,8 +97,8 @@ printf("root mid: %dx%d\n", root_w/2, root_h/2); printf("window mid: %dx%d\n", WIDTH/2, HEIGHT/2); - int xpos = (root_w/2)-(WIDTH/2); - int ypos = (root_h/2)-(HEIGHT/2); + xpos = (root_w/2)-(WIDTH/2); + ypos = (root_h/2)-(HEIGHT/2); printf("final pos: %dx%d\n", xpos, ypos); @@ -100,12 +107,17 @@ ewl_window_name_set(EWL_WINDOW(win), "Empower!"); ewl_window_class_set(EWL_WINDOW(win), "Empower!"); ewl_object_size_request(EWL_OBJECT(win), WIDTH, HEIGHT); - ewl_window_override_set(EWL_WINDOW(win), 1); ewl_window_move(EWL_WINDOW(win), xpos, ypos); + + /* + ewl_window_override_set(EWL_WINDOW(win), 1); ewl_window_keyboard_grab_set(EWL_WINDOW(win),1); ewl_window_pointer_grab_set(EWL_WINDOW(win),1); + */ + ewl_window_raise(EWL_WINDOW(win)); ewl_callback_append(win, EWL_CALLBACK_DELETE_WINDOW, destroy_cb, NULL); + ewl_callback_append(win, EWL_CALLBACK_REVEAL, reveal_cb, NULL); ewl_widget_show(win); vbox = ewl_vbox_new(); |