[beryl-commits] r1470 - trunk/beryl-plugins/src

marex at server.beryl-project.org marex at server.beryl-project.org
Sat Dec 2 00:22:32 CET 2006


Author: marex
Date: 2006-12-02 00:22:31 +0100 (Sat, 02 Dec 2006)
New Revision: 1470

Modified:
   trunk/beryl-plugins/src/group.c
Log:
beryl-plugins: group: Changed the way the selection-effect is painted


Modified: trunk/beryl-plugins/src/group.c
===================================================================
--- trunk/beryl-plugins/src/group.c	2006-11-30 19:39:50 UTC (rev 1469)
+++ trunk/beryl-plugins/src/group.c	2006-12-01 23:22:31 UTC (rev 1470)
@@ -20,10 +20,10 @@
  *
  *
  * TODO:
- *      * colors for each group
  *      * glow effect
- *      * group naming
  *      * tab like switching between the windows
+ *      * a lot of other tab stuff...
+ *      * provide a tree system for groups
  *
  **/
 
@@ -202,6 +202,7 @@
     WindowMoveNotifyProc        windowMoveNotify;
     WindowResizeNotifyProc      windowResizeNotify;
     PaintScreenProc             paintScreen;
+    PaintWindowProc             paintWindow;
     PaintTransformedScreenProc  paintTransformedScreen; 
 
     int                         wMask;
@@ -231,11 +232,6 @@
     int     oldX;
     int     oldY;
 
-    // for paint
-    int     oldOpacity;
-    int     oldSaturation;
-    int     oldBrightness;
-
 } GroupWindow;
 
 /*
@@ -488,61 +484,6 @@
 }
 
 /*
- * groupPaintFocus
- *
- */
-static void
-groupPaintFocus (CompWindow* w)
-{
-    GROUP_SCREEN (w->screen);
-    GROUP_WINDOW (w);
-    CompDisplay *d = w->screen->display;
-    int opacity = gs->opt[GROUP_SCREEN_OPTION_OPACITY].value.i;
-    int saturation = gs->opt[GROUP_SCREEN_OPTION_SATURATION].value.i;
-    int brightness = gs->opt[GROUP_SCREEN_OPTION_BRIGHTNESS].value.i;
-    
-    gw->oldOpacity = w->opacity;
-    opacity = OPAQUE * opacity / 100;
-    w->paint.opacity = opacity;
-    setWindowProp32 (d, w->id, d->winOpacityAtom, w->paint.opacity);
-    
-    gw->oldSaturation = w->saturation;
-    saturation = COLOR * saturation / 100;
-    w->paint.saturation = saturation;
-    setWindowProp32 (d, w->id, d->winSaturationAtom, w->paint.saturation);
-
-    gw->oldBrightness = w->brightness;
-    brightness = BRIGHT * brightness / 100;
-    w->paint.brightness = brightness;
-    setWindowProp32 (d, w->id, d->winBrightnessAtom, w->paint.brightness);
-    addWindowDamage (w);
-}
-
-/*
- * groupPaintUnFocus
- *
- */
-static void
-groupPaintUnFocus (CompWindow* w)
-{
-    CompDisplay *d = w->screen->display;
-    GROUP_WINDOW (w);
-    int opacity = gw->oldOpacity;
-    int saturation = gw->oldSaturation;
-    int brightness = gw->oldBrightness;
-    
-    w->paint.opacity = opacity;
-    setWindowProp32 (d, w->id, d->winOpacityAtom, w->paint.opacity);
-    
-    w->paint.saturation = saturation;
-    setWindowProp32 (d, w->id, d->winSaturationAtom, w->paint.saturation);
-
-    w->paint.brightness = brightness;
-    setWindowProp32 (d, w->id, d->winBrightnessAtom, w->paint.brightness);
-    addWindowDamage (w);
-}
-
-/*
  * groupSyncWindows
  *
  */
@@ -615,10 +556,10 @@
 
     o = &gs->opt[GROUP_SCREEN_OPTION_TYPES];
     o->name              = "mask";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc         = N_("Window Types");
+    o->group             = N_("");
+    o->subGroup          = N_("");
+    o->displayHints      = "";
+    o->shortDesc         = N_("Window Types");
     o->longDesc          = N_("The types of windows which will be grouped");
     o->type              = CompOptionTypeList;
     o->value.list.type   = CompOptionTypeString;
@@ -633,10 +574,10 @@
 
     o = &gs->opt[GROUP_SCREEN_OPTION_OPACITY];
     o->name = "opacity";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Opacity");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Opacity");
     o->longDesc = N_("Opacity of selected windows");
     o->type = CompOptionTypeInt;
     o->value.i = GROUP_OPACITY_DEFAULT;
@@ -645,10 +586,10 @@
     
     o = &gs->opt[GROUP_SCREEN_OPTION_SATURATION];
     o->name = "saturation";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Saturation");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Saturation");
     o->longDesc = N_("Saturation of selected windows");
     o->type = CompOptionTypeInt;
     o->value.i = GROUP_SATURATION_DEFAULT;
@@ -657,10 +598,10 @@
     
     o = &gs->opt[GROUP_SCREEN_OPTION_BRIGHTNESS];
     o->name = "brightness";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Brightness");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Brightness");
     o->longDesc = N_("Brightness of selected windows");
     o->type = CompOptionTypeInt;
     o->value.i = GROUP_BRIGHTNESS_DEFAULT;
@@ -669,10 +610,10 @@
 
     o = &gs->opt[GROUP_SCREEN_OPTION_TOLERANCE];
     o->name = "tolerance";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Tolerance");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Tolerance");
     o->longDesc = N_("Tolerance of the seletion.");
     o->type = CompOptionTypeInt;
     o->value.i = GROUP_TOLERANCE_DEFAULT;
@@ -681,10 +622,10 @@
 
     o = &gs->opt[GROUP_SCREEN_OPTION_MOVE];
     o->name = "move";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Move every window in the group");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Move every window in the group");
     o->longDesc = N_("If one window in the group gets moved, "
                   "every other window in the group gets moved as well.");
     o->type = CompOptionTypeBool;
@@ -692,10 +633,10 @@
 
     o = &gs->opt[GROUP_SCREEN_OPTION_RESIZE];
     o->name = "resize";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Resize every window in the group");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Resize every window in the group");
     o->longDesc = N_("If one window in the group gets resized, "
                   "every other window in the group gets resized as well.");
     o->type = CompOptionTypeBool;
@@ -703,10 +644,10 @@
 
     o = &gs->opt[GROUP_SCREEN_OPTION_RAISE];
     o->name = "raise";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Raise every window in the group");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints   = "";
+    o->shortDesc = N_("Raise every window in the group");
     o->longDesc = N_("If one window in the group gets selected, "
                   "every window in the group gets raised.");
     o->type = CompOptionTypeBool;
@@ -714,10 +655,10 @@
 
     o = &gs->opt[GROUP_SCREEN_OPTION_AUTO_GROUP];
     o->name = "auto_group";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Group the windows after selection");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Group the windows after selection");
     o->longDesc = N_("If you have selected your windows," 
                      "this automatically groups them. "
                      "(Doesn't work with selection mode 'normal')");
@@ -726,20 +667,20 @@
 
     o = &gs->opt[GROUP_SCREEN_OPTION_AUTO_UNGROUP];
     o->name = "auto_ungroup";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Ungroup the windows if only one window is left");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Ungroup the windows if only one window is left");
     o->longDesc = N_("If there is only 1 window in the group left, it will be ungrouped.");
     o->type = CompOptionTypeBool;
     o->value.b = GROUP_AUTO_UNGROUP_DEFAULT;
 
     o = &gs->opt[GROUP_SCREEN_OPTION_RELATIVE_DISTANCE];
     o->name = "relative_distance";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc = N_("Compute distance relative");
+    o->group = N_("");
+    o->subGroup = N_("");
+    o->displayHints = "";
+    o->shortDesc = N_("Compute distance relative");
     o->longDesc = N_("The distance between the windows is computed relative to the window size. " 
                      "This allows you to have windows staying next to eachother.");
     o->type = CompOptionTypeBool;
@@ -747,10 +688,10 @@
 
     o             = &gs->opt[GROUP_SCREEN_OPTION_SELECTION_COLOR];
     o->name       = "fill_color";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc  = N_("Selection Color");
+    o->group      = N_("");
+    o->subGroup   = N_("");
+    o->displayHints = "";
+    o->shortDesc  = N_("Selection Color");
     o->longDesc   = N_("Fill color of the selection.");
     o->type       = CompOptionTypeColor;
     o->value.c[0] = GROUP_COLOR_SELECTION_RED_DEFAULT;
@@ -760,10 +701,10 @@
 
     o             = &gs->opt[GROUP_SCREEN_OPTION_LINE_COLOR];
     o->name       = "line_color";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc  = N_("Line Color");
+    o->group      = N_("");
+    o->subGroup   = N_("");
+    o->displayHints = "";
+    o->shortDesc  = N_("Line Color");
     o->longDesc   = N_("Line color of the selection.");
     o->type       = CompOptionTypeColor;
     o->value.c[0] = GROUP_COLOR_LINE_RED_DEFAULT;
@@ -878,8 +819,8 @@
 
        groupAddWindowToSelection (d, w); 
 
-       groupPaintFocus (w);
        gw->inSelection = TRUE;
+       addWindowDamage (w);
     }
 
     // unselect single window
@@ -890,8 +831,8 @@
     {   
         groupDeleteSelectionWindow (d, w);
         
-        groupPaintUnFocus (w);
         gw->inSelection = FALSE;
+        addWindowDamage (w);
     }
 
     // select group
@@ -914,8 +855,8 @@
             
              groupAddWindowToSelection (d, cw);
             
-             groupPaintFocus (cw);
              gw->inSelection = TRUE;
+             addWindowDamage (cw);
         }
     }
 
@@ -943,8 +884,8 @@
             
               if (gw->inGroup && gw->groupID == gd->groups[index].id)
               {
-                  groupPaintUnFocus (cw);
                   gw->inSelection = FALSE;
+                  addWindowDamage (cw);
                   continue;
               }
 
@@ -952,7 +893,8 @@
           }
           gd->tmpSel.nWins = counter;
           free (buf);
-     }
+    }
+
 }
 
 /*
@@ -1120,7 +1062,7 @@
             groupAddWindowToGroup(d, cw, id);
 
             gw->inSelection = FALSE;
-            groupPaintUnFocus (cw);
+            addWindowDamage (cw);
         }
 
         // exit selection
@@ -1609,7 +1551,44 @@
     }
 }
 
+/*
+ * groupDrawWindow
+ *
+ */
+static Bool
+groupPaintWindow (CompWindow * w,
+                  const WindowPaintAttrib * attrib,
+                  Region region, unsigned int mask)
+{
+    Bool status;
+    GROUP_WINDOW  (w);
+    GROUP_SCREEN  (w->screen);
 
+    WindowPaintAttrib gAttrib = *attrib;
+
+    if (gw->inSelection)
+    {
+        int opacity = gs->opt[GROUP_SCREEN_OPTION_OPACITY].value.i;
+        int saturation = gs->opt[GROUP_SCREEN_OPTION_SATURATION].value.i;
+        int brightness = gs->opt[GROUP_SCREEN_OPTION_BRIGHTNESS].value.i;
+        
+        opacity = OPAQUE * opacity / 100;
+        saturation = COLOR * saturation / 100;
+        brightness = BRIGHT * brightness / 100;
+        
+        gAttrib.opacity = opacity;
+        gAttrib.saturation = saturation;
+        gAttrib.brightness = brightness;
+    }   
+
+    UNWRAP (gs, w->screen, paintWindow);
+    status = (*w->screen->paintWindow) (w, &gAttrib, region, mask);
+    WRAP (gs, w->screen, paintWindow, groupPaintWindow);
+
+    return status;
+}
+
+
 /*
  * groupHandleMotionEvent
  *
@@ -1658,10 +1637,10 @@
 
     o = &gd->opt[GROUP_DISPLAY_OPTION_SELECT];
     o->name                             = "select";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc                        = N_("Select");
+    o->group                            = N_("");
+    o->subGroup                         = N_("");
+    o->displayHints                     = "";
+    o->shortDesc                        = N_("Select");
     o->longDesc                         = N_("The key for starting selecting windows.");
     o->type                             = CompOptionTypeAction;
     o->value.action.initiate            = groupSelect;
@@ -1675,10 +1654,10 @@
 
     o = &gd->opt[GROUP_DISPLAY_OPTION_SELECT_SINGLE];
     o->name                             = "select_single";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc                        = N_("Select single window");
+    o->group                            = N_("");
+    o->subGroup                         = N_("");
+    o->displayHints                     = "";
+    o->shortDesc                        = N_("Select single window");
     o->longDesc                         = N_("The key for selecting the current window.");
     o->type                             = CompOptionTypeAction;
     o->value.action.initiate            = groupSelectSingle;
@@ -1692,10 +1671,10 @@
 
     o = &gd->opt[GROUP_DISPLAY_OPTION_GROUPING];
     o->name                             = "group";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc                        = N_("Group");
+    o->group                            = N_("");
+    o->subGroup                         = N_("");
+    o->displayHints                     = "";
+    o->shortDesc                        = N_("Group");
     o->longDesc                         = N_("The key for grouing windows.");
     o->type                             = CompOptionTypeAction;
     o->value.action.initiate            = groupGroupWindows;
@@ -1709,10 +1688,10 @@
 
     o = &gd->opt[GROUP_DISPLAY_OPTION_UNGROUPING];
     o->name                             = "ungroup";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc                        = N_("Ungroup");
+    o->group                            = N_("");
+    o->subGroup                         = N_("");
+    o->displayHints                     = "";
+    o->shortDesc                        = N_("Ungroup");
     o->longDesc                         = N_("The key for ungrouing windows.");
     o->type                             = CompOptionTypeAction;
     o->value.action.initiate            = groupUnGroupWindows;
@@ -1726,10 +1705,10 @@
 
     o = &gd->opt[GROUP_DISPLAY_OPTION_REMOVEING];
     o->name                             = "remove";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc                        = N_("Remove Window");
+    o->group                            = N_("");
+    o->subGroup                         = N_("");
+    o->displayHints                     = "";
+    o->shortDesc                        = N_("Remove Window");
     o->longDesc                         = N_("The key for removing the selected window.");
     o->type                             = CompOptionTypeAction;
     o->value.action.initiate            = groupRemoveWindow;
@@ -1743,10 +1722,10 @@
 
     o = &gd->opt[GROUP_DISPLAY_OPTION_CLOSEING];
     o->name                             = "close";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc                        = N_("Close Windows");
+    o->group                            = N_("");
+    o->subGroup                         = N_("");
+    o->displayHints                     = "";
+    o->shortDesc                        = N_("Close Windows");
     o->longDesc                         = N_("The key for closing all windows in the group.");
     o->type                             = CompOptionTypeAction;
     o->value.action.initiate            = groupCloseWindows;
@@ -1760,10 +1739,10 @@
 
     o = &gd->opt[GROUP_DISPLAY_OPTION_MINIMIZEING];
     o->name                             = "minimize";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc                        = N_("Minimize Windows");
+    o->group                            = N_("");
+    o->subGroup                         = N_("");
+    o->displayHints                     = "";
+    o->shortDesc                        = N_("Minimize Windows");
     o->longDesc                         = N_("The key for minimizeing all windows in the group.");
     o->type                             = CompOptionTypeAction;
     o->value.action.initiate            = groupMinimizeWindows;
@@ -1777,10 +1756,10 @@
 
     o = &gd->opt[GROUP_DISPLAY_OPTION_IGNORE];
     o->name                             = "ignore";
-    o->group=N_("");
-o->subGroup=N_("");
-o->displayHints="";
-o->shortDesc                        = N_("Ignore Group");
+    o->group                            = N_("");
+    o->subGroup                         = N_("");
+    o->displayHints                     = "";
+    o->shortDesc                        = N_("Ignore Group");
     o->longDesc                         = N_("The key for ignoring the group."
                                              "If this key is pressed you can resize/move a single" 
                                              "window in the group.");
@@ -1952,6 +1931,7 @@
     WRAP (gs, s, windowMoveNotify,   groupWindowMoveNotify);
     WRAP (gs, s, windowResizeNotify, groupWindowResizeNotify);
     WRAP (gs, s, paintScreen, groupPaintScreen);
+    WRAP (gs, s, paintWindow, groupPaintWindow);
     WRAP (gs, s, paintTransformedScreen, groupPaintTransformedScreen);
 
     s->privates[gd->screenPrivateIndex].ptr = gs;
@@ -1984,6 +1964,7 @@
     UNWRAP (gs, s, windowMoveNotify);
     UNWRAP (gs, s, windowResizeNotify);
     UNWRAP (gs, s, paintScreen);
+    UNWRAP (gs, s, paintWindow);
     UNWRAP (gs, s, paintTransformedScreen);
 
     free (gs);
@@ -2009,9 +1990,6 @@
     gw->oldHeight = WIN_HEIGHT (w);
     gw->oldX = WIN_X (w);
     gw->oldY = WIN_Y (w);
-    gw->oldOpacity = w->opacity;
-    gw->oldSaturation = w->saturation;
-    gw->oldBrightness = w->brightness;
 
     w->privates[gs->windowPrivateIndex].ptr = gw;
 




More information about the commits mailing list