summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarex <marex@beryl-project.org>2007-02-20 00:32:22 +0100
committermarex <marex@beryl-project.org>2007-02-20 00:32:22 +0100
commit40718e76a09ddd3aa56b95140d3525a0726e98b5 (patch)
treed365706f2a668c2b04fd7dcbfaddbf7b91605164
parent0300947e4c6962311f60d1ae76e765904c8da797 (diff)
downloadmarex-dev-40718e76a09ddd3aa56b95140d3525a0726e98b5.tar.gz
marex-dev-40718e76a09ddd3aa56b95140d3525a0726e98b5.tar.bz2
group: Added initial support for different styles
-rw-r--r--beryl-plugins/src/group/group.h156
-rw-r--r--beryl-plugins/src/group/option.c76
-rw-r--r--beryl-plugins/src/group/paint.c24
-rw-r--r--beryl-plugins/src/wall.c2
4 files changed, 160 insertions, 98 deletions
diff --git a/beryl-plugins/src/group/group.h b/beryl-plugins/src/group/group.h
index a7573ff..9be3533 100644
--- a/beryl-plugins/src/group/group.h
+++ b/beryl-plugins/src/group/group.h
@@ -48,62 +48,68 @@
*/
#define PI 3.1415926535897
-#define GROUP_DISPLAY_OPTION_SELECT 0
-#define GROUP_DISPLAY_OPTION_SELECT_SINGLE 1
-#define GROUP_DISPLAY_OPTION_GROUPING 2
-#define GROUP_DISPLAY_OPTION_UNGROUPING 3
-#define GROUP_DISPLAY_OPTION_REMOVING 4
-#define GROUP_DISPLAY_OPTION_CLOSING 5
-#define GROUP_DISPLAY_OPTION_IGNORE 6
-#define GROUP_DISPLAY_OPTION_TABMODE 7
-#define GROUP_DISPLAY_OPTION_CHANGE_TAB_LEFT 8
-#define GROUP_DISPLAY_OPTION_CHANGE_TAB_RIGHT 9
-#define GROUP_DISPLAY_OPTION_CHANGE_COLOR 10
-#define GROUP_DISPLAY_OPTION_NUM 11
-
-#define GROUP_SCREEN_OPTION_TYPES 0
-#define GROUP_SCREEN_OPTION_OPACITY 1
-#define GROUP_SCREEN_OPTION_SATURATION 2
-#define GROUP_SCREEN_OPTION_BRIGHTNESS 3
-#define GROUP_SCREEN_OPTION_GLOW 4
-#define GROUP_SCREEN_OPTION_MOVE 5
-#define GROUP_SCREEN_OPTION_RESIZE 6
-#define GROUP_SCREEN_OPTION_RAISE 7
-#define GROUP_SCREEN_OPTION_AUTO_UNGROUP 8
-#define GROUP_SCREEN_OPTION_AUTO_GROUP 9
-#define GROUP_SCREEN_OPTION_RELATIVE_DISTANCE 10
-#define GROUP_SCREEN_OPTION_SELECTION_COLOR 11
-#define GROUP_SCREEN_OPTION_LINE_COLOR 12
-#define GROUP_SCREEN_OPTION_PRECISION 13
-#define GROUP_SCREEN_OPTION_TABBING_SPEED 14
-#define GROUP_SCREEN_OPTION_TABBING_TIMESTEP 15
-#define GROUP_SCREEN_OPTION_THUMB_SIZE 16
-#define GROUP_SCREEN_OPTION_BORDER_WIDTH 17
-#define GROUP_SCREEN_OPTION_BORDER_RADIUS 18
-#define GROUP_SCREEN_OPTION_TAB_BORDER_COLOR 19
-#define GROUP_SCREEN_OPTION_TAB_FILL_COLOR 20
-#define GROUP_SCREEN_OPTION_GLOW_SIZE 21
-#define GROUP_SCREEN_OPTION_GLOW_TYPE 22
-#define GROUP_SCREEN_OPTION_FADE_TIME 23
-#define GROUP_SCREEN_OPTION_VISIBILITY_TIME 24
-#define GROUP_SCREEN_OPTION_UNTAB_ON_CLOSE 25
-#define GROUP_SCREEN_OPTION_TABBAR_FONTSIZE 26
-#define GROUP_SCREEN_OPTION_FADE_TEXT_TIME 27
-#define GROUP_SCREEN_OPTION_TABBAR_FONTCOLOR 28
-#define GROUP_SCREEN_OPTION_TAB_CREATE_MIPMAPS 29
-#define GROUP_SCREEN_OPTION_CHANGE_ANIMATION_TIME 30
-#define GROUP_SCREEN_OPTION_TAB_DRAG_HOVER_TIME 31
-#define GROUP_SCREEN_OPTION_TAB_DRAG_SPRING_K 32
-#define GROUP_SCREEN_OPTION_TAB_DRAG_FRICTION 33
-#define GROUP_SCREEN_OPTION_TAB_DRAG_Y_DISTANCE 34
-#define GROUP_SCREEN_OPTION_TAB_DRAG_SPEED_LIMIT 35
-#define GROUP_SCREEN_OPTION_SPRING_MODEL_ON_MOVE 36
-#define GROUP_SCREEN_OPTION_AUTOTAB 37
-#define GROUP_SCREEN_OPTION_DND_UNGROUP_WINDOW 38
-#define GROUP_SCREEN_OPTION_RESIZE_UNMAXIMIZE 39
-#define GROUP_SCREEN_OPTION_MINIMIZE_ALL 40
-#define GROUP_SCREEN_OPTION_SHADE_ALL 41
-#define GROUP_SCREEN_OPTION_NUM 42
+enum {
+ GROUP_DISPLAY_OPTION_SELECT = 0,
+ GROUP_DISPLAY_OPTION_SELECT_SINGLE,
+ GROUP_DISPLAY_OPTION_GROUPING,
+ GROUP_DISPLAY_OPTION_UNGROUPING,
+ GROUP_DISPLAY_OPTION_REMOVING,
+ GROUP_DISPLAY_OPTION_CLOSING,
+ GROUP_DISPLAY_OPTION_IGNORE,
+ GROUP_DISPLAY_OPTION_TABMODE,
+ GROUP_DISPLAY_OPTION_CHANGE_TAB_LEFT,
+ GROUP_DISPLAY_OPTION_CHANGE_TAB_RIGHT,
+ GROUP_DISPLAY_OPTION_CHANGE_COLOR,
+ GROUP_DISPLAY_OPTION_NUM
+};
+
+enum {
+ GROUP_SCREEN_OPTION_TYPES = 0,
+ GROUP_SCREEN_OPTION_OPACITY,
+ GROUP_SCREEN_OPTION_SATURATION,
+ GROUP_SCREEN_OPTION_BRIGHTNESS,
+ GROUP_SCREEN_OPTION_GLOW,
+ GROUP_SCREEN_OPTION_MOVE,
+ GROUP_SCREEN_OPTION_RESIZE,
+ GROUP_SCREEN_OPTION_RAISE,
+ GROUP_SCREEN_OPTION_AUTO_UNGROUP,
+ GROUP_SCREEN_OPTION_AUTO_GROUP,
+ GROUP_SCREEN_OPTION_RELATIVE_DISTANCE,
+ GROUP_SCREEN_OPTION_SELECTION_COLOR,
+ GROUP_SCREEN_OPTION_LINE_COLOR,
+ GROUP_SCREEN_OPTION_PRECISION,
+ GROUP_SCREEN_OPTION_TABBING_SPEED,
+ GROUP_SCREEN_OPTION_TABBING_TIMESTEP,
+ GROUP_SCREEN_OPTION_THUMB_SIZE,
+ GROUP_SCREEN_OPTION_BORDER_WIDTH,
+ GROUP_SCREEN_OPTION_BORDER_RADIUS,
+ GROUP_SCREEN_OPTION_TAB_BORDER_COLOR,
+ GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR,
+ GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR,
+ GROUP_SCREEN_OPTION_TAB_STYLE,
+ GROUP_SCREEN_OPTION_GLOW_SIZE,
+ GROUP_SCREEN_OPTION_GLOW_TYPE,
+ GROUP_SCREEN_OPTION_FADE_TIME,
+ GROUP_SCREEN_OPTION_VISIBILITY_TIME,
+ GROUP_SCREEN_OPTION_UNTAB_ON_CLOSE,
+ GROUP_SCREEN_OPTION_TABBAR_FONTSIZE,
+ GROUP_SCREEN_OPTION_FADE_TEXT_TIME,
+ GROUP_SCREEN_OPTION_TABBAR_FONTCOLOR,
+ GROUP_SCREEN_OPTION_TAB_CREATE_MIPMAPS,
+ GROUP_SCREEN_OPTION_CHANGE_ANIMATION_TIME,
+ GROUP_SCREEN_OPTION_TAB_DRAG_HOVER_TIME,
+ GROUP_SCREEN_OPTION_TAB_DRAG_SPRING_K,
+ GROUP_SCREEN_OPTION_TAB_DRAG_FRICTION,
+ GROUP_SCREEN_OPTION_TAB_DRAG_Y_DISTANCE,
+ GROUP_SCREEN_OPTION_TAB_DRAG_SPEED_LIMIT,
+ GROUP_SCREEN_OPTION_SPRING_MODEL_ON_MOVE,
+ GROUP_SCREEN_OPTION_AUTOTAB,
+ GROUP_SCREEN_OPTION_DND_UNGROUP_WINDOW,
+ GROUP_SCREEN_OPTION_RESIZE_UNMAXIMIZE,
+ GROUP_SCREEN_OPTION_MINIMIZE_ALL,
+ GROUP_SCREEN_OPTION_SHADE_ALL,
+ GROUP_SCREEN_OPTION_NUM
+};
/*
* Helpers
@@ -146,26 +152,29 @@
#define IS_PREV_TOP_TAB(w, group) (HAS_PREV_TOP_WIN(group) && ((PREV_TOP_TAB(group)->id) == (w)->id))
/*
- * Debug
+ * Structs
*
*/
-#define GROUP_DEBUG(msg, level) (groupDebugPrint(msg, level))
-
-typedef enum {
- DEBUG_OFF = 0,
- DEBUG_IMPORTANT,
- DEBUG_INFO,
- DEBUG_ALL
-} DebugLevel;
/*
- * Structs
- *
+ * tab bar styles
*/
+static char *tabBarStyleNames[] = {
+ N_("Simple"),
+ N_("Gradient"),
+ N_("Glass")
+};
+
+typedef enum {
+ StyleSimple = 0,
+ StyleGradient,
+ StyleGlass,
+ StyleNum
+} TabBarStyle;
/*
* window states
-*/
+ */
typedef enum {
WindowNormal = 0,
WindowMinimized,
@@ -460,6 +469,7 @@ typedef struct _GroupScreen {
Bool queued;
Bool tabBarVisible;
+ TabBarStyle tabBarStyle;
GlowTextureType glowType;
GroupScreenGrabState grabState;
@@ -654,14 +664,4 @@ Bool groupSelect(CompDisplay * d, CompAction * action, CompActionState state, Co
Bool groupSelectTerminate(CompDisplay * d, CompAction * action, CompActionState state, CompOption * option, int nOption);
void groupDamageSelectionRect(CompScreen* s, int xRoot, int yRoot);
-/*
- * debug.c
- */
-void groupDebugPrintMsg(char* msg, DebugLevel level);
-void groupDebugPrintGroup(GroupSelection *group);
-void groupDebugPrintScreen(GroupScreen *gs);
-void groupDebugPrintWindow(GroupWindow *gw);
-void groupDebugPrintTabBar(GroupTabBar *bar);
-void groupDebugPrintTabBarSlot(GroupTabBarSlot *slot);
-
#endif
diff --git a/beryl-plugins/src/group/option.c b/beryl-plugins/src/group/option.c
index b84a85c..7615044 100644
--- a/beryl-plugins/src/group/option.c
+++ b/beryl-plugins/src/group/option.c
@@ -131,10 +131,15 @@
#define GROUP_COLOR_LINE_BLUE_DEFAULT 0x0000
#define GROUP_COLOR_LINE_ALPHA_DEFAULT 0xABAB
-#define GROUP_COLOR_TAB_FILL_RED_DEFAULT 0x0000
-#define GROUP_COLOR_TAB_FILL_GREEN_DEFAULT 0x0000
-#define GROUP_COLOR_TAB_FILL_BLUE_DEFAULT 0x0000
-#define GROUP_COLOR_TAB_FILL_ALPHA_DEFAULT 0x9999
+#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_RED_DEFAULT 0x5555
+#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_GREEN_DEFAULT 0x5555
+#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_BLUE_DEFAULT 0x5555
+#define GROUP_COLOR_TAB_FILL_HIGHLIGHT_ALPHA_DEFAULT 0x9999
+
+#define GROUP_COLOR_TAB_FILL_BASE_RED_DEFAULT 0x0000
+#define GROUP_COLOR_TAB_FILL_BASE_GREEN_DEFAULT 0x0000
+#define GROUP_COLOR_TAB_FILL_BASE_BLUE_DEFAULT 0x0000
+#define GROUP_COLOR_TAB_FILL_BASE_ALPHA_DEFAULT 0x9999
#define GROUP_COLOR_TAB_BORDER_RED_DEFAULT 0x0000
#define GROUP_COLOR_TAB_BORDER_GREEN_DEFAULT 0x0000
@@ -146,6 +151,8 @@
#define GROUP_COLOR_TABBAR_FONT_GREEN_DEFAULT 0xFFFF
#define GROUP_COLOR_TABBAR_FONT_ALPHA_DEFAULT 0xFFFF
+#define GROUP_TAB_STYLE_DEFAULT StyleSimple
+
#define GROUP_GLOW_TYPE_DEFAULT GlowTextureRectangular
#define GROUP_FADE_TIME_MIN 0.0f
@@ -484,24 +491,38 @@ void groupScreenInitOptions(GroupScreen * gs)
o->value.c[2] = GROUP_COLOR_LINE_BLUE_DEFAULT;
o->value.c[3] = GROUP_COLOR_LINE_ALPHA_DEFAULT;
- o = &gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_COLOR];
- o->name = "tab_color";
+ o = &gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR];
+ o->name = "tab_highlight_color";
o->group = N_("Tabbing");
- o->subGroup = N_("Colors");
+ o->subGroup = N_("Style");
+ o->displayHints = "";
+ o->advanced = False;
+ o->shortDesc = N_("Tab Highlight Color");
+ o->longDesc = N_("Fill color of the tab bar.");
+ o->type = CompOptionTypeColor;
+ o->value.c[0] = GROUP_COLOR_TAB_FILL_HIGHLIGHT_RED_DEFAULT;
+ o->value.c[1] = GROUP_COLOR_TAB_FILL_HIGHLIGHT_GREEN_DEFAULT;
+ o->value.c[2] = GROUP_COLOR_TAB_FILL_HIGHLIGHT_BLUE_DEFAULT;
+ o->value.c[3] = GROUP_COLOR_TAB_FILL_HIGHLIGHT_ALPHA_DEFAULT;
+
+ o = &gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR];
+ o->name = "tab_base_color";
+ o->group = N_("Tabbing");
+ o->subGroup = N_("Style");
o->displayHints = "";
o->advanced = False;
- o->shortDesc = N_("Tab Color");
+ o->shortDesc = N_("Tab Base Color");
o->longDesc = N_("Fill color of the tab bar.");
o->type = CompOptionTypeColor;
- o->value.c[0] = GROUP_COLOR_TAB_FILL_RED_DEFAULT;
- o->value.c[1] = GROUP_COLOR_TAB_FILL_GREEN_DEFAULT;
- o->value.c[2] = GROUP_COLOR_TAB_FILL_BLUE_DEFAULT;
- o->value.c[3] = GROUP_COLOR_TAB_FILL_ALPHA_DEFAULT;
+ o->value.c[0] = GROUP_COLOR_TAB_FILL_BASE_RED_DEFAULT;
+ o->value.c[1] = GROUP_COLOR_TAB_FILL_BASE_GREEN_DEFAULT;
+ o->value.c[2] = GROUP_COLOR_TAB_FILL_BASE_BLUE_DEFAULT;
+ o->value.c[3] = GROUP_COLOR_TAB_FILL_BASE_ALPHA_DEFAULT;
o = &gs->opt[GROUP_SCREEN_OPTION_TAB_BORDER_COLOR];
o->name = "border_color";
o->group = N_("Tabbing");
- o->subGroup = N_("Colors");
+ o->subGroup = N_("Style");
o->displayHints = "";
o->advanced = False;
o->shortDesc = N_("Tab Border Color");
@@ -512,6 +533,19 @@ void groupScreenInitOptions(GroupScreen * gs)
o->value.c[2] = GROUP_COLOR_TAB_BORDER_BLUE_DEFAULT;
o->value.c[3] = GROUP_COLOR_TAB_BORDER_ALPHA_DEFAULT;
+ o = &gs->opt[GROUP_SCREEN_OPTION_TAB_STYLE];
+ o->name = "tab_style";
+ o->group = N_("Tabbing");
+ o->subGroup = N_("Style");
+ o->advanced = False;
+ o->shortDesc = N_("Tab Style");
+ o->longDesc = N_("The style of the tab bar.");
+ o->displayHints = "";
+ o->type = CompOptionTypeString;
+ o->value.s = strdup(tabBarStyleNames[GROUP_TAB_STYLE_DEFAULT]);
+ o->rest.s.string = tabBarStyleNames;
+ o->rest.s.nString = StyleNum;
+
o = &gs->opt[GROUP_SCREEN_OPTION_TAB_CREATE_MIPMAPS];
o->name = "mipmaps";
o->shortDesc = N_("Create mipmaps for thumbnails.");
@@ -821,7 +855,8 @@ groupSetScreenOption(CompScreen * s, char *name, CompOptionValue * value)
case GROUP_SCREEN_OPTION_SELECTION_COLOR:
case GROUP_SCREEN_OPTION_LINE_COLOR:
- case GROUP_SCREEN_OPTION_TAB_FILL_COLOR:
+ case GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR:
+ case GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR:
case GROUP_SCREEN_OPTION_TAB_BORDER_COLOR:
if (compSetColorOption(o, value)) {
return TRUE;
@@ -865,6 +900,19 @@ groupSetScreenOption(CompScreen * s, char *name, CompOptionValue * value)
}
}
break;
+
+ case GROUP_SCREEN_OPTION_TAB_STYLE:
+ if (compSetStringOption(o, value)) {
+ int i;
+ for (i = 0; i < StyleNum; i++)
+ {
+ if (strcmp(o->value.s, tabBarStyleNames[i]) == 0) {
+ gs->tabBarStyle = i;
+ return TRUE;
+ }
+ }
+ }
+ break;
case GROUP_SCREEN_OPTION_OPACITY:
case GROUP_SCREEN_OPTION_BRIGHTNESS:
diff --git a/beryl-plugins/src/group/paint.c b/beryl-plugins/src/group/paint.c
index eb74bba..4ebc5c2 100644
--- a/beryl-plugins/src/group/paint.c
+++ b/beryl-plugins/src/group/paint.c
@@ -203,12 +203,26 @@ void groupRenderTabBarBackground(GroupSelection *group)
cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
// fill
- r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_COLOR].value.c[0] / 65535.0f;
- g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_COLOR].value.c[1] / 65535.0f;
- b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_COLOR].value.c[2] / 65535.0f;
- a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_COLOR].value.c[3] / 65535.0f;
- cairo_set_source_rgba(cr, r, g, b, a);
+ cairo_pattern_t *pattern;
+ pattern = cairo_pattern_create_linear(0, 0, width, height);
+
+ // highlight color
+ r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[0] / 65535.0f;
+ g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[1] / 65535.0f;
+ b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[2] / 65535.0f;
+ a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_HIGHLIGHT_COLOR].value.c[3] / 65535.0f;
+ cairo_pattern_add_color_stop_rgba(pattern, 0.0f, r, g, b, a);
+
+ // base color
+ r = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[0] / 65535.0f;
+ g = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[1] / 65535.0f;
+ b = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[2] / 65535.0f;
+ a = gs->opt[GROUP_SCREEN_OPTION_TAB_FILL_BASE_COLOR].value.c[3] / 65535.0f;
+ cairo_pattern_add_color_stop_rgba(pattern, 1.0f, r, g, b, a);
+
+ cairo_set_source(cr, pattern);
cairo_fill_preserve(cr);
+ cairo_pattern_destroy(pattern);
// outline
r = gs->opt[GROUP_SCREEN_OPTION_TAB_BORDER_COLOR].value.c[0] / 65535.0f;
diff --git a/beryl-plugins/src/wall.c b/beryl-plugins/src/wall.c
index 5c4d0d1..2e18195 100644
--- a/beryl-plugins/src/wall.c
+++ b/beryl-plugins/src/wall.c
@@ -2165,7 +2165,7 @@ wallSetDisplayOption(CompDisplay * d, char *name, CompOptionValue * value)
{
if (strcmp(o->value.s, expoAnimationName[i]) == 0)
{
- wd->expoAnimationType = i;
+ gs->tabBarStyle = i;
return TRUE;
}
}