From b6c8671bca7f749a793153fc0e2a88cd95769f91 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Tue, 29 Dec 2009 20:26:15 +0000 Subject: [PATCH] Fix some quickpanel placement issues. Add function to adjust quickpanel position. Add function to return if border is valid. Set layer of App borders. Reduce variable usage (use valid_count_get directly). SVN revision: 44763 --- src/modules/illume2/e_mod_border.c | 13 +++++++++ src/modules/illume2/e_mod_border.h | 3 ++ src/modules/illume2/e_mod_layout_illume.c | 27 ++++++++++-------- src/modules/illume2/e_quickpanel.c | 34 ++++++++++++++++++----- src/modules/illume2/e_quickpanel.h | 1 + 5 files changed, 59 insertions(+), 19 deletions(-) diff --git a/src/modules/illume2/e_mod_border.c b/src/modules/illume2/e_mod_border.c index 7c7ebc346..e692063b0 100644 --- a/src/modules/illume2/e_mod_border.c +++ b/src/modules/illume2/e_mod_border.c @@ -222,9 +222,22 @@ e_mod_border_is_conformant(E_Border *bd) Eina_Bool e_mod_border_is_quickpanel(E_Border *bd) { + if (strstr(bd->client.icccm.class, "config")) return EINA_FALSE; return ecore_x_e_illume_quickpanel_get(bd->client.win); } +Eina_Bool +e_mod_border_is_valid(E_Border *bd) +{ + if (!bd) return EINA_FALSE; + if (e_mod_border_is_dialog(bd)) return EINA_FALSE; + if (e_mod_border_is_keyboard(bd)) return EINA_FALSE; + if (e_mod_border_is_bottom_panel(bd)) return EINA_FALSE; + if (e_mod_border_is_top_shelf(bd)) return EINA_FALSE; + if (e_mod_border_is_quickpanel(bd)) return EINA_FALSE; + return EINA_TRUE; +} + Eina_List * e_mod_border_valid_borders_get(E_Zone *zone) { diff --git a/src/modules/illume2/e_mod_border.h b/src/modules/illume2/e_mod_border.h index 49975b127..3a289566d 100644 --- a/src/modules/illume2/e_mod_border.h +++ b/src/modules/illume2/e_mod_border.h @@ -26,12 +26,15 @@ Eina_Bool e_mod_border_is_side_pane_right(E_Border *bd); Eina_Bool e_mod_border_is_overlay(E_Border *bd); Eina_Bool e_mod_border_is_conformant(E_Border *bd); Eina_Bool e_mod_border_is_quickpanel(E_Border *bd); +Eina_Bool e_mod_border_is_valid(E_Border *bd); Eina_List *e_mod_border_valid_borders_get(E_Zone *zone); E_Border *e_mod_border_valid_border_get(E_Zone *zone); int e_mod_border_valid_count_get(E_Zone *zone); + Eina_List *e_mod_border_quickpanel_borders_get(E_Zone *zone); int e_mod_border_quickpanel_count_get(E_Zone *zone); + E_Border *e_mod_border_at_xy_get(E_Zone *zone, int x, int y); E_Border *e_mod_border_in_region_get(E_Zone *zone, int x, int y, int w, int h); E_Border *e_mod_border_keyboard_get(E_Zone *zone); diff --git a/src/modules/illume2/e_mod_layout_illume.c b/src/modules/illume2/e_mod_layout_illume.c index 0f88a6d0b..29d4f55ff 100644 --- a/src/modules/illume2/e_mod_layout_illume.c +++ b/src/modules/illume2/e_mod_layout_illume.c @@ -5,6 +5,7 @@ #include "e_mod_layout.h" #include "e_mod_layout_illume.h" #include "e_kbd.h" +#include "e_quickpanel.h" /* define some values here for easily changing layers so we don't have to * grep through code to change layers */ @@ -79,19 +80,21 @@ _border_resize_fx(E_Border *bd, int bx, int by, int bw, int bh) bd->client.w = bw; bd->client.h = bh; bd->changes.size = 1; + bd->changed = 1; } if ((bd->x != bx) || (bd->y != by)) { bd->x = bx; bd->y = by; bd->changes.pos = 1; + bd->changed = 1; } } else { - if ((bd->w != bw) || (bd->h != bh)) + if ((bd->w != bw) || (bd->h != bh)) e_border_resize(bd, bw, bh); - if ((bd->x != bx) || (bd->y != by)) + if ((bd->x != bx) || (bd->y != by)) e_border_fx_offset(bd, bx, by); } } @@ -186,6 +189,8 @@ _border_activate(E_Border *bd) { /* HANDLE A BORDER BEING ACTIVATED */ + if (bd->stolen) return; + /* only set focus if border accepts it and it's not locked out */ if (((!bd->client.icccm.accepts_focus) && (!bd->client.icccm.take_focus)) || (bd->lock_focus_out)) @@ -331,9 +336,13 @@ _zone_layout(E_Zone *z) e_border_resize(bd, bd->zone->w, mh); if (bd->layer != IL_QUICKPANEL_LAYER) e_border_layer_set(bd, IL_QUICKPANEL_LAYER); + bd->lock_user_stacking = 1; } else { + if (bd->layer != IL_APP_LAYER) + e_border_layer_set(bd, IL_APP_LAYER); + /* normal border, handle layout based on policy mode */ if (il_cfg->policy.mode.dual) _zone_layout_dual(bd); else _zone_layout_single(bd); @@ -382,10 +391,7 @@ static void _zone_layout_dual_top(E_Border *bd) { int kx, ky, kw, kh, ss, ps; - int count, conform; - - /* get count of valid borders */ - count = e_mod_border_valid_count_get(bd->zone); + int conform; /* fetch if this border is conformant */ conform = e_mod_border_is_conformant(bd); @@ -404,7 +410,7 @@ _zone_layout_dual_top(E_Border *bd) } /* if there are no other borders, than give this one all available space */ - if (count < 2) + if (e_mod_border_valid_count_get(bd->zone) < 2) _border_resize_fx(bd, kx, (ky + ss), kw, (kh - ss - ps)); else { @@ -574,10 +580,7 @@ static void _zone_layout_dual_left(E_Border *bd) { int kx, ky, kw, kh, ss, ps; - int count, conform; - - /* get count of valid borders */ - count = e_mod_border_valid_count_get(bd->zone); + int conform; /* fetch if this border is conformant */ conform = e_mod_border_is_conformant(bd); @@ -596,7 +599,7 @@ _zone_layout_dual_left(E_Border *bd) } /* if there are no other borders, than give this one all available space */ - if (count < 2) + if (e_mod_border_valid_count_get(bd->zone) < 2) _border_resize_fx(bd, kx, (ky + ss), kw, (kh - ss - ps)); else { diff --git a/src/modules/illume2/e_quickpanel.c b/src/modules/illume2/e_quickpanel.c index 7a578dc1a..5942a51f9 100644 --- a/src/modules/illume2/e_quickpanel.c +++ b/src/modules/illume2/e_quickpanel.c @@ -107,6 +107,25 @@ e_quickpanel_by_zone_get(E_Zone *zone) return NULL; } +void +e_quickpanel_position_update(E_Quickpanel *qp) +{ + Eina_List *l; + E_Border *bd; + int ty; + + if (!qp) return; + e_mod_border_top_shelf_pos_get(qp->zone, NULL, &ty); + EINA_LIST_FOREACH(qp->borders, l, bd) + { + bd->x = qp->zone->x; + bd->y = (ty - qp->h); + bd->changed = 1; + bd->changes.pos = 1; +// e_border_move(bd, qp->zone->x, (ty - qp->h)); + } +} + /* local functions */ static void _e_quickpanel_cb_free(E_Quickpanel *qp) @@ -146,15 +165,14 @@ _e_quickpanel_cb_border_pre_post_fetch(void *data, void *data2) { E_Border *bd; E_Quickpanel *qp; - int ty, th; + int ty; if (!(bd = data2)) return; if (!bd->new_client) return; - if (_e_quickpanel_by_border_get(bd)) return; if (!_e_quickpanel_border_is_quickpanel(bd)) return; + if (_e_quickpanel_by_border_get(bd)) return; if (!(qp = e_quickpanel_by_zone_get(bd->zone))) return; e_mod_border_top_shelf_pos_get(qp->zone, NULL, &ty); - e_mod_border_top_shelf_size_get(qp->zone, NULL, &th); bd->stolen = 1; if (bd->remember) { @@ -172,7 +190,12 @@ _e_quickpanel_cb_border_pre_post_fetch(void *data, void *data2) qp->h += bd->h; e_border_move(bd, qp->zone->x, (ty - qp->h)); if (qp->visible) - e_border_fx_offset(bd, 0, (bd->h - th)); + { + int th; + + e_mod_border_top_shelf_size_get(qp->zone, NULL, &th); + e_border_fx_offset(bd, 0, (bd->h - th)); + } qp->borders = eina_list_append(qp->borders, bd); } @@ -281,12 +304,9 @@ _e_quickpanel_hide(E_Quickpanel *qp) { Eina_List *l; E_Border *bd; - int th; - e_mod_border_top_shelf_size_get(qp->zone, NULL, &th); EINA_LIST_FOREACH(qp->borders, l, bd) e_border_fx_offset(bd, 0, 0); -// e_border_fx_offset(bd, 0, -th); qp->visible = 0; } else diff --git a/src/modules/illume2/e_quickpanel.h b/src/modules/illume2/e_quickpanel.h index 737245a44..a6d9f85a2 100644 --- a/src/modules/illume2/e_quickpanel.h +++ b/src/modules/illume2/e_quickpanel.h @@ -24,5 +24,6 @@ E_Quickpanel *e_quickpanel_new(E_Zone *zone); void e_quickpanel_show(E_Quickpanel *qp); void e_quickpanel_hide(E_Quickpanel *qp); E_Quickpanel *e_quickpanel_by_zone_get(E_Zone *zone); +void e_quickpanel_position_update(E_Quickpanel *qp); #endif