Enlightenment CVS committal Author : sebastid Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_border.c e_hints.c e_hints.h Log Message: Hints cleanup. Send the border to hints, not the client.win. It's easier to keep the current border state cache uptodate. =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v retrieving revision 1.164 retrieving revision 1.165 diff -u -3 -r1.164 -r1.165 --- e_border.c 29 Apr 2005 08:02:28 -0000 1.164 +++ e_border.c 29 Apr 2005 08:37:08 -0000 1.165 @@ -406,7 +406,7 @@ if (bd->visible) return; e_container_shape_show(bd->shape); e_container_window_show(bd->zone->container, bd->client.win, bd->layer); - e_hints_window_visible_set(bd->client.win); + e_hints_window_visible_set(bd); bd->visible = 1; bd->changes.visible = 1; @@ -434,7 +434,7 @@ e_container_window_hide(bd->zone->container, bd->client.win, bd->layer); e_container_shape_hide(bd->shape); if (!bd->iconic) - e_hints_window_hidden_set(bd->client.win); + e_hints_window_hidden_set(bd); bd->visible = 0; bd->changes.visible = 1; @@ -700,21 +700,21 @@ * now the focus is on Y where it should be on X */ ecore_x_icccm_take_focus_send(bd->client.win, ecore_x_current_time_get()); - e_hints_active_window_set(bd->container->manager, bd->client.win); + e_hints_active_window_set(bd->container->manager, bd); ecore_x_window_focus(bd->client.win); } else { // printf("set focus\n"); ecore_x_window_focus(bd->client.win); - e_hints_active_window_set(bd->container->manager, bd->client.win); + e_hints_active_window_set(bd->container->manager, bd); } } else { // printf("remove focus\n"); ecore_x_window_focus(bd->container->manager->win); - e_hints_active_window_set(bd->container->manager, 0); + e_hints_active_window_set(bd->container->manager, NULL); } } if ((bd->focused) && (focused != bd)) @@ -741,8 +741,8 @@ bd->shade.y = bd->y; bd->shade.dir = dir; - e_hints_window_shaded_set(bd->client.win, 1); - e_hints_window_shade_direction_set(bd->client.win, dir); + e_hints_window_shaded_set(bd, 1); + e_hints_window_shade_direction_set(bd, dir); if (e_config->border_shade_animate) { @@ -818,8 +818,8 @@ bd->shade.dir = dir; - e_hints_window_shaded_set(bd->client.win, 0); - e_hints_window_shade_direction_set(bd->client.win, dir); + e_hints_window_shaded_set(bd, 0); + e_hints_window_shade_direction_set(bd, dir); if (bd->shade.dir == E_DIRECTION_UP || bd->shade.dir == E_DIRECTION_LEFT) @@ -906,7 +906,7 @@ bd->saved.w = bd->w; bd->saved.h = bd->h; - e_hints_window_maximized_set(bd->client.win, 1); + e_hints_window_maximized_set(bd, 1); /* FIXME maximize intelligently */ e_border_raise(bd); @@ -929,7 +929,7 @@ if (bd->maximized) { // printf("UNMAXIMIZE!!\n"); - e_hints_window_maximized_set(bd->client.win, 0); + e_hints_window_maximized_set(bd, 0); e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h); @@ -955,7 +955,7 @@ bd->saved.w = bd->w; bd->saved.h = bd->h; - e_hints_window_fullscreen_set(bd->client.win, 1); + e_hints_window_fullscreen_set(bd, 1); bd->layer = 200; @@ -983,7 +983,7 @@ if ((bd->shaded) || (bd->shading)) return; if (bd->fullscreen) { - e_hints_window_fullscreen_set(bd->client.win, 0); + e_hints_window_fullscreen_set(bd, 0); e_border_move_resize(bd, bd->saved.x, bd->saved.y, bd->saved.w, bd->saved.h); @@ -1015,7 +1015,7 @@ edje_object_signal_emit(bd->bg_object, "iconify", ""); } iconic = 1; - e_hints_window_iconic_set(bd->client.win); + e_hints_window_iconic_set(bd); ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_MAPPED, &iconic, 1); ev = E_NEW(E_Event_Border_Iconify, 1); @@ -1060,7 +1060,7 @@ E_OBJECT_CHECK(bd); E_OBJECT_TYPE_CHECK(bd, E_BORDER_TYPE); bd->sticky = 1; - e_hints_window_sticky_set(bd->client.win, 1); + e_hints_window_sticky_set(bd, 1); ev = E_NEW(E_Event_Border_Stick, 1); ev->border = bd; @@ -1078,7 +1078,7 @@ /* Set the desk before we unstick the border */ e_border_desk_set(bd, e_desk_current_get(bd->zone)); bd->sticky = 0; - e_hints_window_sticky_set(bd->client.win, 0); + e_hints_window_sticky_set(bd, 0); ev = E_NEW(E_Event_Border_Unstick, 1); ev->border = bd; @@ -2545,8 +2545,7 @@ /* fetch any info queued to be fetched */ if (bd->client.icccm.fetch.title) { - if (bd->client.icccm.title) free(bd->client.icccm.title); - bd->client.icccm.title = e_hints_window_name_get(bd->client.win); + e_hints_window_name_get(bd); bd->client.icccm.fetch.title = 0; if (bd->bg_object) { =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_hints.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -3 -r1.14 -r1.15 --- e_hints.c 29 Apr 2005 08:02:29 -0000 1.14 +++ e_hints.c 29 Apr 2005 08:37:09 -0000 1.15 @@ -149,30 +149,34 @@ } void -e_hints_active_window_set(E_Manager *man, Ecore_X_Window win) +e_hints_active_window_set(E_Manager *man, E_Border *bd) { E_OBJECT_CHECK(man); - ecore_x_netwm_client_active_set(man->root, win); + if (bd) + ecore_x_netwm_client_active_set(man->root, bd->client.win); + else + ecore_x_netwm_client_active_set(man->root, 0); } void -e_hints_window_name_set(Ecore_X_Window win, const char *name) +e_hints_window_name_set(E_Border *bd) { - ecore_x_icccm_title_set(win, name); - ecore_x_netwm_name_set(win, name); + ecore_x_icccm_title_set(bd->client.win, bd->client.icccm.title); + ecore_x_netwm_name_set(bd->client.win, bd->client.icccm.title); } -char * -e_hints_window_name_get(Ecore_X_Window win) +void +e_hints_window_name_get(E_Border *bd) { char *name; - name = ecore_x_netwm_name_get(win); + name = ecore_x_netwm_name_get(bd->client.win); if (!name) - name = ecore_x_icccm_title_get(win); + name = ecore_x_icccm_title_get(bd->client.win); if (!name) name = strdup("No name!!"); - return name; + if (bd->client.icccm.title) free(bd->client.icccm.title); + bd->client.icccm.title = name; } void @@ -267,7 +271,7 @@ if (bd->client.netwm.state.sticky) e_border_stick(bd); if (bd->client.netwm.state.shaded) - e_border_shade(bd, e_hints_window_shade_direction_get(bd->client.win)); + e_border_shade(bd, e_hints_window_shade_direction_get(bd)); if (bd->client.netwm.state.maximized_v && bd->client.netwm.state.maximized_h) e_border_maximize(bd); if (bd->client.icccm.state == ECORE_X_WINDOW_STATE_HINT_ICONIC) @@ -356,45 +360,78 @@ } void -e_hints_window_visible_set(Ecore_X_Window win) +e_hints_window_visible_set(E_Border *bd) { - ecore_x_icccm_state_set(win, ECORE_X_WINDOW_STATE_HINT_NORMAL); - ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_HIDDEN, 0); + if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_NORMAL) + { + ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_NORMAL); + bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_NORMAL; + } + if (bd->client.netwm.state.hidden) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HIDDEN, 0); + bd->client.netwm.state.hidden = 0; + } } void -e_hints_window_iconic_set(Ecore_X_Window win) +e_hints_window_iconic_set(E_Border *bd) { - ecore_x_icccm_state_set(win, ECORE_X_WINDOW_STATE_HINT_ICONIC); - ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_HIDDEN, 1); + if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_ICONIC) + { + ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_ICONIC); + bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_ICONIC; + } + if (!bd->client.netwm.state.hidden) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HIDDEN, 1); + bd->client.netwm.state.hidden = 1; + } } void -e_hints_window_hidden_set(Ecore_X_Window win) +e_hints_window_hidden_set(E_Border *bd) { - ecore_x_icccm_state_set(win, ECORE_X_WINDOW_STATE_HINT_WITHDRAWN); - ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_HIDDEN, 1); + if (bd->client.icccm.state != ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) + { + ecore_x_icccm_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HINT_WITHDRAWN); + bd->client.icccm.state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; + } + if (!bd->client.netwm.state.hidden) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_HIDDEN, 1); + bd->client.netwm.state.hidden = 1; + } } void -e_hints_window_shaded_set(Ecore_X_Window win, int on) +e_hints_window_shaded_set(E_Border *bd, int on) { - ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_SHADED, on); + if ((!bd->client.netwm.state.shaded) && (on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_SHADED, 1); + bd->client.netwm.state.shaded = 1; + } + else if ((bd->client.netwm.state.shaded) && (!on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_SHADED, 0); + bd->client.netwm.state.shaded = 0; + } } void -e_hints_window_shade_direction_set(Ecore_X_Window win, E_Direction dir) +e_hints_window_shade_direction_set(E_Border *bd, E_Direction dir) { - ecore_x_window_prop_card32_set(win, E_ATOM_SHADE_DIRECTION, &dir, 1); + ecore_x_window_prop_card32_set(bd->client.win, E_ATOM_SHADE_DIRECTION, &dir, 1); } E_Direction -e_hints_window_shade_direction_get(Ecore_X_Window win) +e_hints_window_shade_direction_get(E_Border *bd) { int ret; E_Direction dir; - ret = ecore_x_window_prop_card32_get(win, + ret = ecore_x_window_prop_card32_get(bd->client.win, E_ATOM_SHADE_DIRECTION, &dir, 1); if (ret == 1) @@ -404,22 +441,59 @@ } void -e_hints_window_maximized_set(Ecore_X_Window win, int on) +e_hints_window_maximized_set(E_Border *bd, int on) { - ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, on); - ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, on); + if ((!bd->client.netwm.state.maximized_v) && (on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, 1); + bd->client.netwm.state.maximized_v = 1; + } + else if ((bd->client.netwm.state.maximized_v) && (!on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, 0); + bd->client.netwm.state.maximized_v = 0; + } + if ((!bd->client.netwm.state.maximized_h) && (on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, 1); + bd->client.netwm.state.maximized_h = 1; + } + else if ((bd->client.netwm.state.maximized_h) && (!on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, 0); + bd->client.netwm.state.maximized_h = 0; + } } void -e_hints_window_fullscreen_set(Ecore_X_Window win, int on) +e_hints_window_fullscreen_set(E_Border *bd, int on) { - ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_FULLSCREEN, on); + if ((!bd->client.netwm.state.fullscreen) && (on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_FULLSCREEN, 1); + bd->client.netwm.state.fullscreen = 1; + } + else if ((bd->client.netwm.state.fullscreen) && (!on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_FULLSCREEN, 0); + bd->client.netwm.state.fullscreen = 0; + } } void -e_hints_window_sticky_set(Ecore_X_Window win, int on) +e_hints_window_sticky_set(E_Border *bd, int on) { - ecore_x_netwm_window_state_set(win, ECORE_X_WINDOW_STATE_STICKY, on); + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_STICKY, on); + if ((!bd->client.netwm.state.sticky) && (on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_STICKY, 1); + bd->client.netwm.state.sticky = 1; + } + else if ((bd->client.netwm.state.sticky) && (!on)) + { + ecore_x_netwm_window_state_set(bd->client.win, ECORE_X_WINDOW_STATE_STICKY, 0); + bd->client.netwm.state.sticky = 0; + } } /* @@ -432,13 +506,11 @@ */ void -e_hints_window_icon_name_get(Ecore_X_Window win) +e_hints_window_icon_name_get(E_Border *bd) { - E_Border *bd; char *name; - name = ecore_x_netwm_icon_name_get(win); - bd = e_border_find_by_client_window(win); + name = ecore_x_netwm_icon_name_get(bd->client.win); if (bd->client.icccm.icon_name) free(bd->client.icccm.icon_name); bd->client.icccm.icon_name = name; =================================================================== RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_hints.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -3 -r1.9 -r1.10 --- e_hints.h 29 Apr 2005 08:02:29 -0000 1.9 +++ e_hints.h 29 Apr 2005 08:37:09 -0000 1.10 @@ -9,26 +9,33 @@ EAPI void e_hints_init(void); EAPI void e_hints_client_list_set(void); EAPI void e_hints_client_stacking_set(void); -EAPI void e_hints_active_window_set(E_Manager *man, Ecore_X_Window win); -EAPI void e_hints_window_name_set(Ecore_X_Window win, const char *name); -EAPI char *e_hints_window_name_get(Ecore_X_Window win); + +EAPI void e_hints_active_window_set(E_Manager *man, E_Border *bd); + +EAPI void e_hints_window_name_set(E_Border *bd); +EAPI void e_hints_window_name_get(E_Border *bd); + EAPI void e_hints_desktop_config_set(void); + EAPI void e_hints_window_init(E_Border *bd); EAPI void e_hints_window_state_set(E_Border *bd); EAPI void e_hints_window_state_get(E_Border *bd); EAPI void e_hints_window_type_set(E_Border *bd); EAPI void e_hints_window_type_get(E_Border *bd); -EAPI void e_hints_window_visible_set(Ecore_X_Window win); -EAPI void e_hints_window_iconic_set(Ecore_X_Window win); -EAPI void e_hints_window_hidden_set(Ecore_X_Window win); -EAPI void e_hints_window_shaded_set(Ecore_X_Window win, int on); -EAPI void e_hints_window_shade_direction_set(Ecore_X_Window win, E_Direction dir); -EAPI E_Direction e_hints_window_shade_direction_get(Ecore_X_Window win); - -EAPI void e_hints_window_maximized_set(Ecore_X_Window win, int on); -EAPI void e_hints_window_sticky_set(Ecore_X_Window win, int on); -EAPI void e_hints_window_fullscreen_set(Ecore_X_Window win, int on); -EAPI void e_hints_window_icon_name_get(Ecore_X_Window win); + +EAPI void e_hints_window_visible_set(E_Border *bd); +EAPI void e_hints_window_iconic_set(E_Border *bd); +EAPI void e_hints_window_hidden_set(E_Border *bd); + +EAPI void e_hints_window_shade_direction_set(E_Border *bd, E_Direction dir); +EAPI E_Direction e_hints_window_shade_direction_get(E_Border *bd); + +EAPI void e_hints_window_shaded_set(E_Border *bd, int on); +EAPI void e_hints_window_maximized_set(E_Border *bd, int on); +EAPI void e_hints_window_sticky_set(E_Border *bd, int on); +EAPI void e_hints_window_fullscreen_set(E_Border *bd, int on); + +EAPI void e_hints_window_icon_name_get(E_Border *bd); #endif #endif ------------------------------------------------------- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs