Recent Posts
None | 12 sec ago
None | 54 sec ago
None | 1 min ago
Make | 2 min ago
None | 2 min ago
None | 2 min ago
XML | 3 min ago
Pascal | 3 min ago
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Domain Reports
Please check out our new and improved Firefox Add-on. hide message
By pekwm-0.1.12-opacity.patch on the 7th of Jun 2010 11:51:14 AM Download | Raw | Embed | Report
  1. diff -Naur pekwm-0.1.12-ori/configure pekwm-0.1.12/configure
  2. --- pekwm-0.1.12-ori/configure  2010-04-07 00:24:11.000000000 +0200
  3. +++ pekwm-0.1.12/configure      2010-06-07 13:21:29.373468039 +0200
  4. @@ -768,6 +768,7 @@
  5.  enable_pedantic
  6.  enable_menus
  7.  enable_harbour
  8. +enable_opacity
  9.  '
  10.        ac_precious_vars='build_alias
  11.  host_alias
  12. @@ -1440,6 +1441,8 @@
  13.    --enable-pedantic       turn on strict compile-time warnings default=no
  14.    --enable-menus          include menu support default=yes
  15.    --enable-harbour        include harbour default=yes
  16. +  --enable-opacity        enable opacity hinting for running under
  17. +                          composite managers default=no
  18.  
  19.  Optional Packages:
  20.    --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
  21. @@ -9453,6 +9456,30 @@
  22.  $as_echo "no" >&6; }
  23.  fi
  24.  
  25. +
  26. +{ $as_echo "$as_me:$LINENO: checking whether to include opacity hinting" >&5
  27. +$as_echo_n "checking whether to include opacity hinting... " >&6; }
  28. +# Check whether --enable-opacity was given.
  29. +if test "${enable_opacity+set}" = set; then
  30. +  enableval=$enable_opacity;
  31. +else
  32. +  enableval=no
  33. +fi
  34. +
  35. +if test "x$enableval" = "xyes"; then
  36. +       { $as_echo "$as_me:$LINENO: result: yes" >&5
  37. +$as_echo "yes" >&6; }
  38. +
  39. +cat >>confdefs.h <<\_ACEOF
  40. +#define OPACITY 1
  41. +_ACEOF
  42. +
  43. +       FEATURES="$FEATURES opacity"
  44. +else
  45. +       { $as_echo "$as_me:$LINENO: result: no" >&5
  46. +$as_echo "no" >&6; }
  47. +fi
  48. +
  49.  EVO=`date`
  50.  
  51.  cat >>confdefs.h <<_ACEOF
  52. diff -Naur pekwm-0.1.12-ori/configure.ac pekwm-0.1.12/configure.ac
  53. --- pekwm-0.1.12-ori/configure.ac       2010-04-07 00:23:55.000000000 +0200
  54. +++ pekwm-0.1.12/configure.ac   2010-06-07 13:24:06.802467154 +0200
  55. @@ -331,6 +331,20 @@
  56.         AC_MSG_RESULT([no])
  57.  fi
  58.  
  59. +dnl Check whether to include opacity hinting
  60. +AC_MSG_CHECKING([whether to include opacity hinting])
  61. +AC_ARG_ENABLE(opacity,
  62. +       AC_HELP_STRING([--enable-opacity],
  63. +                                                                [include opacity hinting [default=no]]), ,
  64. +                                                       [enableval=no])
  65. +if test "x$enableval" = "xyes"; then
  66. +       AC_MSG_RESULT([yes])
  67. +       AC_DEFINE(OPACITY, [1], [Define to 1 to compile in support for opacity hinting])
  68. +       FEATURES="$FEATURES opacity"
  69. +else
  70. +       AC_MSG_RESULT([no])
  71. +fi
  72. +
  73.  dnl define build info
  74.  EVO=`date`
  75.  AC_DEFINE_UNQUOTED(FEATURES, "$FEATURES", [Build info, do not touch])
  76. diff -Naur pekwm-0.1.12-ori/src/ActionHandler.cc pekwm-0.1.12/src/ActionHandler.cc
  77. --- pekwm-0.1.12-ori/src/ActionHandler.cc       2010-06-07 13:25:03.101468702 +0200
  78. +++ pekwm-0.1.12/src/ActionHandler.cc   2010-06-07 18:42:22.513718656 +0200
  79. @@ -239,6 +239,11 @@
  80.              case ACTION_ATTACH_FRAME_IN_PREV_FRAME:
  81.                  WindowManager::instance()->attachInNextPrevFrame(client, true, false);
  82.                  break;
  83. +#ifdef OPACITY
  84. +            case ACTION_SET_OPACITY:
  85. +                actionSetOpacity(client, frame, it->getParamI(0), it->getParamI(1));
  86. +                break;
  87. +#endif // OPACITY
  88.              default:
  89.                  matched = false;
  90.                  break;
  91. @@ -461,6 +466,11 @@
  92.          case ACTION_STATE_TITLE:
  93.              frame->setStateTitle(sa, client, Util::to_wide_str(action.getParamS()));
  94.              break;
  95. +#ifdef OPACITY
  96. +        case ACTION_STATE_OPAQUE:
  97. +            frame->setStateOpaque(sa);
  98. +            break;
  99. +#endif // OPACITY
  100.          default:
  101.              matched = false;
  102.              break;
  103. @@ -828,6 +838,19 @@
  104.      return true;
  105.  }
  106.  
  107. +#ifdef OPACITY
  108. +void
  109. +ActionHandler::actionSetOpacity(PWinObj *client, PWinObj *frame, int focus, int unfocus)
  110. +{
  111. +    if (!unfocus)
  112. +        unfocus = focus;
  113. +       std::cerr << "setting opacity to " << focus << "/" << unfocus << std::endl;
  114. +    client->setOpacity(Config::parseOpacity(focus/100.),
  115. +         Config::parseOpacity(unfocus/100.));
  116. +    frame->setOpacity(client);
  117. +}
  118. +#endif // OPACITY
  119. +
  120.  #ifdef MENUS
  121.  //! @brief Toggles visibility of menu.
  122.  //! @param name Name of menu to toggle visibilty of
  123. diff -Naur pekwm-0.1.12-ori/src/ActionHandler.hh pekwm-0.1.12/src/ActionHandler.hh
  124. --- pekwm-0.1.12-ori/src/ActionHandler.hh       2010-06-07 13:25:03.102468569 +0200
  125. +++ pekwm-0.1.12/src/ActionHandler.hh   2010-06-07 18:42:22.513718656 +0200
  126. @@ -52,6 +52,9 @@
  127.      void actionFocusToggle(uint button, uint raise, int off, bool show_iconified, bool mru);
  128.      void actionFocusDirectional(PWinObj *wo, DirectionType dir, bool raise);
  129.      bool actionSendKey(PWinObj *wo, const std::string &key_str);
  130. +#ifdef OPACITY
  131. +    void actionSetOpacity(PWinObj *client, PWinObj *frame, int focus, int unfocus);
  132. +#endif // OPACITY
  133.  #ifdef MENUS
  134.      void actionShowMenu(const std::string &name, bool stick, uint e_type, PWinObj *wo_ref);
  135.  #endif // MENUS
  136. diff -Naur pekwm-0.1.12-ori/src/Action.hh pekwm-0.1.12/src/Action.hh
  137. --- pekwm-0.1.12-ori/src/Action.hh      2010-06-07 13:25:03.100468765 +0200
  138. +++ pekwm-0.1.12/src/Action.hh  2010-06-07 18:42:22.512719279 +0200
  139. @@ -76,6 +76,7 @@
  140.  
  141.      ACTION_HIDE_WORKSPACE_INDICATOR,
  142.      ACTION_SEND_KEY,
  143. +    ACTION_SET_OPACITY,
  144.  
  145.      ACTION_NO
  146.  };
  147. @@ -88,7 +89,7 @@
  148.      ACTION_STATE_DECOR, ACTION_STATE_TITLE,
  149.      ACTION_STATE_ICONIFIED, ACTION_STATE_TAGGED,
  150.      ACTION_STATE_MARKED, ACTION_STATE_SKIP,
  151. -    ACTION_STATE_CFG_DENY,
  152. +    ACTION_STATE_CFG_DENY, ACTION_STATE_OPAQUE,
  153.  
  154.  #ifdef HARBOUR
  155.      ACTION_STATE_HARBOUR_HIDDEN,
  156. diff -Naur pekwm-0.1.12-ori/src/Atoms.cc pekwm-0.1.12/src/Atoms.cc
  157. --- pekwm-0.1.12-ori/src/Atoms.cc       2010-06-07 13:25:03.102468569 +0200
  158. +++ pekwm-0.1.12/src/Atoms.cc   2010-06-07 18:42:22.514740942 +0200
  159. @@ -35,6 +35,7 @@
  160.      "_NET_WM_ICON_NAME", "_NET_WM_VISIBLE_ICON_NAME",
  161.      "_NET_WM_ICON", "_NET_WM_DESKTOP",
  162.      "_NET_WM_STRUT", "_NET_WM_PID",
  163. +    "_NET_WM_WINDOW_OPACITY",
  164.  
  165.      "_NET_WM_WINDOW_TYPE",
  166.      "_NET_WM_WINDOW_TYPE_DESKTOP", "_NET_WM_WINDOW_TYPE_DOCK",
  167. diff -Naur pekwm-0.1.12-ori/src/Atoms.hh pekwm-0.1.12/src/Atoms.hh
  168. --- pekwm-0.1.12-ori/src/Atoms.hh       2010-06-07 13:25:03.103468786 +0200
  169. +++ pekwm-0.1.12/src/Atoms.hh   2010-06-07 18:42:22.514740942 +0200
  170. @@ -37,6 +37,7 @@
  171.      NET_WM_ICON_NAME, NET_WM_VISIBLE_ICON_NAME,
  172.      NET_WM_ICON, NET_WM_DESKTOP,
  173.      NET_WM_STRUT, NET_WM_PID,
  174. +    NET_WM_WINDOW_OPACITY,
  175.  
  176.      WINDOW_TYPE,
  177.      WINDOW_TYPE_DESKTOP, WINDOW_TYPE_DOCK,
  178. diff -Naur pekwm-0.1.12-ori/src/AutoProperties.cc pekwm-0.1.12/src/AutoProperties.cc
  179. --- pekwm-0.1.12-ori/src/AutoProperties.cc      2010-06-07 13:25:03.104468654 +0200
  180. +++ pekwm-0.1.12/src/AutoProperties.cc  2010-06-07 18:42:22.515723558 +0200
  181. @@ -75,6 +75,7 @@
  182.      _property_map["FOCUSNEW"] = AP_FOCUS_NEW;
  183.      _property_map["FOCUSABLE"] = AP_FOCUSABLE;
  184.      _property_map["CFGDENY"] = AP_CFG_DENY;
  185. +    _property_map["OPACITY"] = AP_OPACITY;
  186.  
  187.      // group properties
  188.      _group_property_map[""] = AP_NO_PROPERTY;
  189. @@ -824,7 +825,12 @@
  190.                  }
  191.              }
  192.              break;
  193. -
  194. +#ifdef OPACITY
  195. +        case AP_OPACITY:
  196. +            prop->maskAdd(AP_OPACITY);
  197. +            Config::parseOpacity((*it)->get_value(), prop->focus_opacity, prop->unfocus_opacity);
  198. +            break;
  199. +#endif // OPACITY
  200.          default:
  201.              // do nothing
  202.              break;
  203. diff -Naur pekwm-0.1.12-ori/src/AutoProperties.hh pekwm-0.1.12/src/AutoProperties.hh
  204. --- pekwm-0.1.12-ori/src/AutoProperties.hh      2010-06-07 13:25:03.105468732 +0200
  205. +++ pekwm-0.1.12/src/AutoProperties.hh  2010-06-07 18:42:22.516466335 +0200
  206. @@ -44,6 +44,7 @@
  207.      AP_FOCUS_NEW = (1L << 15),
  208.      AP_FOCUSABLE = (1L << 16),
  209.      AP_CFG_DENY = (1L << 17),
  210. +    AP_OPACITY = (1L << 18),
  211.  
  212.      AP_GROUP_SIZE,
  213.      AP_GROUP_BEHIND,
  214. @@ -147,6 +148,9 @@
  215.      bool border, titlebar;
  216.      bool focusable, place_new, focus_new;
  217.      uint workspace, layer, skip, cfg_deny;
  218. +#ifdef OPACITY
  219. +    ulong focus_opacity, unfocus_opacity;
  220. +#endif //OPACITY
  221.  
  222.      std::string frame_decor;
  223.  
  224. diff -Naur pekwm-0.1.12-ori/src/Client.cc pekwm-0.1.12/src/Client.cc
  225. --- pekwm-0.1.12-ori/src/Client.cc      2010-06-07 13:25:03.107468676 +0200
  226. +++ pekwm-0.1.12/src/Client.cc  2010-06-07 18:42:22.517466272 +0200
  227. @@ -1005,6 +1005,10 @@
  228.      if (ap->isMask(AP_CFG_DENY)) {
  229.          _state.cfg_deny = ap->cfg_deny;
  230.      }
  231. +#ifdef OPACITY
  232. +    if (ap->isMask(AP_OPACITY))
  233. +        setOpacity(ap->focus_opacity, ap->unfocus_opacity);
  234. +#endif // OPACITY
  235.  }
  236.  
  237.  /**
  238. diff -Naur pekwm-0.1.12-ori/src/Config.cc pekwm-0.1.12/src/Config.cc
  239. --- pekwm-0.1.12-ori/src/Config.cc      2010-06-07 13:25:03.112468292 +0200
  240. +++ pekwm-0.1.12/src/Config.cc  2010-06-07 18:42:22.519467401 +0200
  241. @@ -93,6 +93,9 @@
  242.          _screen_show_status_window(true), _screen_show_status_window_on_root(false),
  243.          _screen_show_client_id(false),
  244.          _screen_show_workspace_indicator(500), _screen_workspace_indicator_scale(16),
  245. +#ifdef OPACITY
  246. +        _screen_workspace_indicator_opacity(EWMH_OPAQUE_WINDOW),
  247. +#endif // OPACITY
  248.          _screen_place_new(true), _screen_focus_new(false),
  249.          _screen_focus_new_child(true), _screen_honour_randr(true),
  250.          _screen_honour_aspectratio(true),
  251. @@ -103,12 +106,19 @@
  252.          _screen_client_unique_name_pre(" #"), _screen_client_unique_name_post(""),
  253.          _menu_select_mask(0), _menu_enter_mask(0), _menu_exec_mask(0),
  254.          _menu_display_icons(true),
  255. +#ifdef OPACITY
  256. +        _menu_focus_opacity(EWMH_OPAQUE_WINDOW),
  257. +        _menu_unfocus_opacity(EWMH_OPAQUE_WINDOW),
  258. +#endif // OPACITY
  259.          _cmd_dialog_history_unique(true), _cmd_dialog_history_size(1024),
  260.          _cmd_dialog_history_file("~/.pekwm/history"), _cmd_dialog_history_save_interval(16)
  261.  #ifdef HARBOUR
  262.         ,_harbour_da_min_s(0), _harbour_da_max_s(0),
  263.          _harbour_ontop(true), _harbour_maximize_over(false),
  264.          _harbour_placement(TOP), _harbour_orientation(TOP_TO_BOTTOM), _harbour_head_nr(0)
  265. +#ifdef OPACITY
  266. +       ,_harbour_opacity(EWMH_OPAQUE_WINDOW)
  267. +#endif // OPACITY
  268.  #endif // HARBOUR
  269.  {
  270.      if (_instance) {
  271. @@ -174,6 +184,9 @@
  272.      _action_map["Dynamic"] = pair<ActionType, uint>(ACTION_MENU_DYN, ROOTMENU_OK|WINDOWMENU_OK);
  273.  #endif // MENUS
  274.      _action_map["SendKey"] = pair<ActionType, uint>(ACTION_SEND_KEY, ANY_MASK);
  275. +#ifdef OPACITY
  276. +    _action_map["SetOpacity"] = pair<ActionType, uint>(ACTION_SET_OPACITY, FRAME_MASK);
  277. +#endif // OPACITY
  278.  
  279.      _placement_map[""] = PLACE_NO;
  280.      _placement_map["SMART"] = PLACE_SMART;
  281. @@ -305,6 +318,7 @@
  282.      _action_state_map["Marked"] = ACTION_STATE_MARKED;
  283.      _action_state_map["Skip"] = ACTION_STATE_SKIP;
  284.      _action_state_map["CfgDeny"] = ACTION_STATE_CFG_DENY;
  285. +    _action_state_map["Opaque"] = ACTION_STATE_OPAQUE;
  286.      _action_state_map["Title"] = ACTION_STATE_TITLE;
  287.  #ifdef HARBOUR
  288.      _action_state_map["HarbourHidden"] = ACTION_STATE_HARBOUR_HIDDEN;
  289. @@ -587,6 +601,10 @@
  290.                                             _screen_show_workspace_indicator, 500, 0));
  291.      key_list.push_back(new CfgParserKeyNumeric<int>("WORKSPACEINDICATORSCALE",
  292.                                             _screen_workspace_indicator_scale, 16, 2));
  293. +#ifdef OPACITY
  294. +    key_list.push_back(new CfgParserKeyNumeric<float>("WORKSPACEINDICATOROPACITY",
  295. +                                           _screen_workspace_indicator_opacity, 1.0, 0, 1.0));
  296. +#endif
  297.      key_list.push_back(new CfgParserKeyBool("PLACENEW", _screen_place_new));
  298.      key_list.push_back(new CfgParserKeyBool("FOCUSNEW", _screen_focus_new));
  299.      key_list.push_back(new CfgParserKeyBool("FOCUSNEWCHILD", _screen_focus_new_child, true));
  300. @@ -700,6 +718,10 @@
  301.      key_list.push_back(new CfgParserKeyString("ENTER", value_enter, "BUTTONPRESS", 0));
  302.      key_list.push_back(new CfgParserKeyString("EXEC", value_exec, "BUTTONRELEASE", 0));
  303.      key_list.push_back(new CfgParserKeyBool("DISPLAYICONS", _menu_display_icons, true));
  304. +#ifdef OPACITY
  305. +    key_list.push_back(new CfgParserKeyNumeric<float>("FOCUSOPACITY", _menu_focus_opacity, 1.0, 0.0, 1.0));
  306. +    key_list.push_back(new CfgParserKeyNumeric<float>("UNFOCUSOPACITY", _menu_unfocus_opacity, 1.0, 0.0, 1.0));
  307. +#endif // OPACITY
  308.  
  309.      // Parse data
  310.      section->parse_key_values(key_list.begin(), key_list.end());
  311. @@ -787,6 +809,9 @@
  312.      key_list.push_back(new CfgParserKeyNumeric<int>("HEAD", _harbour_head_nr, 0, 0));
  313.      key_list.push_back(new CfgParserKeyString("PLACEMENT", value_placement, "RIGHT", 0));
  314.      key_list.push_back(new CfgParserKeyString("ORIENTATION", value_orientation, "TOPTOBOTTOM", 0));
  315. +#ifdef OPACITY
  316. +    key_list.push_back(new CfgParserKeyNumeric<float>("OPACITY", _harbour_opacity, 1.0, 0.0, 1.0));
  317. +#endif // OPACITY
  318.  
  319.      // Parse data
  320.      section->parse_key_values(key_list.begin(), key_list.end());
  321. @@ -1042,6 +1067,18 @@
  322.                      }
  323.                      break;
  324.  #endif // MENUS
  325. +#ifdef OPACITY
  326. +                case ACTION_SET_OPACITY:
  327. +                    if ((Util::splitString(tok[1], tok, " \t", 2)) == 2) {
  328. +                        action.setParamI(0, (int)(100*atof(tok[tok.size() - 2].c_str())));
  329. +
  330. +                        action.setParamI(1, (int)(100*atof(tok[tok.size() - 1].c_str())));
  331. +                    } else {
  332. +                        action.setParamI(0, (int)(100*atof(tok[1].c_str())));
  333. +                        action.setParamI(1, (int)(100*atof(tok[1].c_str())));
  334. +                    }
  335. +                    break;
  336. +#endif // OPACITY
  337.                  default:
  338.                      // do nothing
  339.                      break;
  340. @@ -1792,3 +1829,42 @@
  341.  
  342.      return num;
  343.  }
  344. +
  345. +ulong
  346. +Config::parseOpacity(double value)
  347. +{
  348. +    if (value >= 1.0)
  349. +        return EWMH_OPAQUE_WINDOW;
  350. +    return (ulong)(value*EWMH_OPAQUE_WINDOW);
  351. +}
  352. +
  353. +ulong
  354. +Config::parseOpacity(const std::string value)
  355. +{
  356. +    double opacity = atof(value.c_str());
  357. +    if (opacity > 1.0)
  358. +        opacity = 1.0;
  359. +    else if (opacity < 0.0)
  360. +        opacity = 0.0;
  361. +    return Config::parseOpacity(opacity);
  362. +}
  363. +
  364. +//! @brief Parses a string which contains two opacity values
  365. +bool
  366. +Config::parseOpacity(const std::string value, ulong &focused, ulong &unfocused)
  367. +{
  368. +    std::vector<string> tokens;
  369. +    switch ((Util::splitString(value, tokens, " ,", 2))) {
  370. +    case 2:
  371. +        focused = parseOpacity(tokens.at(0));
  372. +        unfocused = parseOpacity(tokens.at(1));
  373. +        break;
  374. +    case 1:
  375. +        focused = unfocused =
  376. +            parseOpacity(tokens.at(0));
  377. +        break;
  378. +    default:
  379. +        return false;
  380. +    }
  381. +    return true;
  382. +}
  383. diff -Naur pekwm-0.1.12-ori/src/Config.hh pekwm-0.1.12/src/Config.hh
  384. --- pekwm-0.1.12-ori/src/Config.hh      2010-06-07 13:25:03.113468788 +0200
  385. +++ pekwm-0.1.12/src/Config.hh  2010-06-07 18:42:22.520466639 +0200
  386. @@ -141,6 +141,9 @@
  387.      inline bool isShowClientID(void) const { return _screen_show_client_id; }
  388.      int getShowWorkspaceIndicator(void) const { return _screen_show_workspace_indicator; }
  389.      int getWorkspaceIndicatorScale(void) const { return _screen_workspace_indicator_scale; }
  390. +#ifdef OPACITY
  391. +    ulong getWorkspaceIndicatorOpacity(void) { return Config::parseOpacity(_screen_workspace_indicator_opacity); }
  392. +#endif // OPACITY
  393.      inline bool isPlaceNew(void) const { return _screen_place_new; }
  394.      inline bool isFocusNew(void) const { return _screen_focus_new; }
  395.      inline bool isFocusNewChild(void) const { return _screen_focus_new_child; }
  396. @@ -168,6 +171,10 @@
  397.      inline bool isMenuEnterOn(uint val) const { return (_menu_enter_mask&val); }
  398.      inline bool isMenuExecOn(uint val) const { return (_menu_exec_mask&val); }
  399.      bool isDisplayMenuIcons(void) const { return _menu_display_icons; }
  400. +#ifdef OPACITY
  401. +    inline ulong getMenuFocusOpacity(void) { return Config::parseOpacity(_menu_focus_opacity); }
  402. +    inline ulong getMenuUnfocusOpacity(void) { return Config::parseOpacity(_menu_unfocus_opacity); }
  403. +#endif // OPACITY
  404.  
  405.      bool isCmdDialogHistoryUnique(void) const { return _cmd_dialog_history_unique; }
  406.      int getCmdDialogHistorySize(void) const { return _cmd_dialog_history_size; }
  407. @@ -182,6 +189,9 @@
  408.      inline bool isHarbourMaximizeOver(void) const { return _harbour_maximize_over; }
  409.      inline uint getHarbourPlacement(void) const { return _harbour_placement; }
  410.      inline uint getHarbourOrientation(void) const { return _harbour_orientation; }
  411. +#ifdef OPACITY
  412. +    inline ulong getHarbourOpacity(void) { return Config::parseOpacity(_harbour_opacity); }
  413. +#endif // OPACITY
  414.  #endif // HARBOUR
  415.  
  416.      inline std::list<ActionEvent>  *getMouseActionList(MouseActionListName name)
  417. @@ -238,6 +248,9 @@
  418.      inline uint getMod(const std::string &mod) { return ParseUtil::getValue<uint>(mod, _mod_map); }
  419.      uint getMouseButton(const std::string& button);
  420.  
  421. +    static bool parseOpacity(const std::string value, ulong &focused, ulong &unfocused);
  422. +    static ulong parseOpacity(double value);
  423. +
  424.  private:
  425.      bool tryHardLoadConfig(CfgParser &cfg, std::string &file);
  426.      void copyConfigFiles(void);
  427. @@ -255,6 +268,7 @@
  428.      void parseButtons(CfgParser::Entry *section, std::list<ActionEvent>* mouse_list, ActionOk action_ok);
  429.  
  430.      int parseWorkspaceNumber(const std::string &workspace);
  431. +    static ulong parseOpacity(const std::string value);
  432.  
  433.  private:
  434.      std::string _config_file; /**< Path to config file last loaded. */
  435. @@ -289,6 +303,9 @@
  436.      bool _screen_show_client_id; //!< Flag to display client ID in title.
  437.      int _screen_show_workspace_indicator; //!< Display workspace indicator for N seconds.
  438.      int _screen_workspace_indicator_scale; //!< Scale of the workspace indicator head
  439. +#ifdef OPACITY
  440. +    float _screen_workspace_indicator_opacity;
  441. +#endif // OPACITY
  442.      bool _screen_place_new, _screen_focus_new, _screen_focus_new_child;
  443.      bool _screen_honour_randr; /**< Boolean flag if randr information should be honoured. */
  444.      bool _screen_honour_aspectratio; /**< if true, pekwm keeps aspect ratio (XSizeHint) */
  445. @@ -300,6 +317,9 @@
  446.  
  447.      uint _menu_select_mask, _menu_enter_mask, _menu_exec_mask;
  448.      bool _menu_display_icons; /**< Boolean flag, when true display icons in menus. */
  449. +#ifdef OPACITY
  450. +    float _menu_focus_opacity, _menu_unfocus_opacity;
  451. +#endif // OPACITY
  452.  
  453.      std::map<std::string, SizeLimits> _menu_icon_limits; /**< Map of name -> limit for icons in menus */
  454.  
  455. @@ -316,6 +336,9 @@
  456.      uint _harbour_placement;
  457.      uint _harbour_orientation;
  458.      int _harbour_head_nr;
  459. +#ifdef OPACITY
  460. +    float _harbour_opacity;
  461. +#endif // OPACITY
  462.  #endif // HARBOUR
  463.  
  464.      std::map<MouseActionListName, std::list<ActionEvent>* > _mouse_action_map;
  465. diff -Naur pekwm-0.1.12-ori/src/Frame.cc pekwm-0.1.12/src/Frame.cc
  466. --- pekwm-0.1.12-ori/src/Frame.cc       2010-06-07 13:25:03.139468343 +0200
  467. +++ pekwm-0.1.12/src/Frame.cc   2010-06-07 18:42:22.521467414 +0200
  468. @@ -466,6 +466,10 @@
  469.          _client->setShaped(setShape());
  470.      }
  471.  
  472. +#ifdef OPACITY
  473. +    setOpacity(_client);
  474. +#endif // OPACITY
  475. +
  476.      if (_focused) {
  477.          child->giveInputFocus();
  478.      }
  479. @@ -1686,6 +1690,17 @@
  480.      renderTitle();
  481.  }
  482.  
  483. +#ifdef OPACITY
  484. +void
  485. +Frame::setStateOpaque(StateAction sa)
  486. +{
  487. +    if (! ActionUtil::needToggle(sa, _opaque)) {
  488. +        return;
  489. +    }
  490. +    _client->setOpaque(!_opaque);
  491. +    setOpaque(!_opaque);
  492. +}
  493. +#endif // OPACITY
  494.  // STATE actions end
  495.  
  496.  //! @brief
  497. diff -Naur pekwm-0.1.12-ori/src/Frame.hh pekwm-0.1.12/src/Frame.hh
  498. --- pekwm-0.1.12-ori/src/Frame.hh       2010-06-07 13:25:03.140468770 +0200
  499. +++ pekwm-0.1.12/src/Frame.hh   2010-06-07 18:42:22.521467414 +0200
  500. @@ -112,6 +112,9 @@
  501.      void setStateSkip(StateAction sa, uint skip);
  502.      void setStateTitle(StateAction sa, Client *client, const std::wstring &title);
  503.      void setStateMarked(StateAction sa, Client *client);
  504. +#ifdef OPACITY
  505. +    void setStateOpaque(StateAction sa);
  506. +#endif // OPACITY
  507.  
  508.      void close(void);
  509.  
  510. diff -Naur pekwm-0.1.12-ori/src/Harbour.cc pekwm-0.1.12/src/Harbour.cc
  511. --- pekwm-0.1.12-ori/src/Harbour.cc     2010-06-07 13:25:03.142468504 +0200
  512. +++ pekwm-0.1.12/src/Harbour.cc 2010-06-07 18:42:22.523466938 +0200
  513. @@ -50,7 +50,9 @@
  514.      _strut = new Strut();
  515.      _scr->addStrut(_strut);
  516.      _strut->head = Config::instance()->getHarbourHead();
  517. -
  518. +#ifdef OPACITY
  519. +    _opacity = Config::instance()->getHarbourOpacity();
  520. +#endif
  521.  #ifdef MENUS
  522.      _harbour_menu = new HarbourMenu(_scr, _theme, this);
  523.  #endif // MENUS
  524. @@ -96,6 +98,9 @@
  525.          da->mapWindow();
  526.      }
  527.  
  528. +#ifdef OPACITY
  529. +    da->setOpacity(_opacity);
  530. +#endif
  531.      updateHarbourSize();
  532.  }
  533.  
  534. diff -Naur pekwm-0.1.12-ori/src/Harbour.hh pekwm-0.1.12/src/Harbour.hh
  535. --- pekwm-0.1.12-ori/src/Harbour.hh     2010-06-07 13:25:03.142468504 +0200
  536. +++ pekwm-0.1.12/src/Harbour.hh 2010-06-07 18:42:22.523466938 +0200
  537. @@ -87,6 +87,9 @@
  538.      uint _size;
  539.      Strut *_strut;
  540.      int _last_button_x, _last_button_y;
  541. +#ifdef OPACITY
  542. +    ulong _opacity;
  543. +#endif // OPACITY
  544.  };
  545.  
  546.  #endif // _HARBOUR_HH_
  547. diff -Naur pekwm-0.1.12-ori/src/pekwm.hh pekwm-0.1.12/src/pekwm.hh
  548. --- pekwm-0.1.12-ori/src/pekwm.hh       2010-06-07 13:25:03.146469163 +0200
  549. +++ pekwm-0.1.12/src/pekwm.hh   2010-06-07 18:42:22.526468773 +0200
  550. @@ -86,6 +86,7 @@
  551.  
  552.  // defines... eek
  553.  #define NET_WM_STICKY_WINDOW   0xffffffff
  554. +#define EWMH_OPAQUE_WINDOW     0xffffffff
  555.  
  556.  // enums
  557.  enum Layer {
  558. diff -Naur pekwm-0.1.12-ori/src/PMenu.cc pekwm-0.1.12/src/PMenu.cc
  559. --- pekwm-0.1.12-ori/src/PMenu.cc       2010-06-07 13:25:03.143468651 +0200
  560. +++ pekwm-0.1.12/src/PMenu.cc   2010-06-07 18:42:22.524469599 +0200
  561. @@ -106,6 +106,10 @@
  562.      _menu_map[_window] = this; // add to menu map
  563.      woListAdd(this);
  564.      _wo_map[_window] = this;
  565. +#ifdef OPACITY
  566. +    setOpacity(Config::instance()->getMenuFocusOpacity(),
  567. +        Config::instance()->getMenuUnfocusOpacity());
  568. +#endif
  569.  }
  570.  
  571.  //! @brief Destructor for PMenu class
  572. diff -Naur pekwm-0.1.12-ori/src/PWinObj.cc pekwm-0.1.12/src/PWinObj.cc
  573. --- pekwm-0.1.12-ori/src/PWinObj.cc     2010-06-07 13:25:03.144468518 +0200
  574. +++ pekwm-0.1.12/src/PWinObj.cc 2010-06-07 18:42:22.525468558 +0200
  575. @@ -15,6 +15,10 @@
  576.  
  577.  #include "PWinObj.hh"
  578.  
  579. +#ifdef OPACITY
  580. +#include "Atoms.hh"
  581. +#endif // OPACITY
  582. +
  583.  using std::cerr;
  584.  using std::endl;
  585.  using std::find;
  586. @@ -34,6 +38,9 @@
  587.        _mapped(false), _iconified(false), _hidden(false),
  588.        _focused(false), _sticky(false),
  589.        _focusable(true)
  590. +#ifdef OPACITY
  591. +     ,_opaque(true)
  592. +#endif // OPACITY
  593.  {
  594.  }
  595.  
  596. @@ -63,6 +70,37 @@
  597.      }
  598.  }
  599.  
  600. +#ifdef OPACITY
  601. +//! @brief Sets the desired opacity values for focused/unfocused states
  602. +void
  603. +PWinObj::setOpacity(ulong focused, ulong unfocused, bool enabled)
  604. +{
  605. +    _opacity.focused = focused;
  606. +    _opacity.unfocused = unfocused;
  607. +    _opaque = !enabled;
  608. +    updateOpacity();
  609. +}
  610. +
  611. +//! @brief Updates the opacity Xhint based on focused state
  612. +void
  613. +PWinObj::updateOpacity(void)
  614. +{
  615. +    ulong opacity;
  616. +    if (_opaque)
  617. +        opacity = EWMH_OPAQUE_WINDOW;
  618. +    else
  619. +        opacity = isFocused()?_opacity.focused:_opacity.unfocused;
  620. +
  621. +    if (_opacity.current != opacity) {
  622. +        _opacity.current = opacity;
  623. +        XChangeProperty(_dpy, _window,
  624. +                        Atoms::getAtom(NET_WM_WINDOW_OPACITY),
  625. +                        XA_CARDINAL,
  626. +                        32, PropModeReplace, (uchar*) &opacity, 1);
  627. +    }
  628. +}
  629. +#endif // OPACITY
  630. +
  631.  //! @brief Maps the window and sets _mapped to true.
  632.  void
  633.  PWinObj::mapWindow(void)
  634. @@ -195,11 +233,14 @@
  635.      _layer = layer;
  636.  }
  637.  
  638. -//! @brief Only sets _focused to focused.
  639. +//! @brief Sets _focused to focused and updates opacity as needed.
  640.  void
  641.  PWinObj::setFocused(bool focused)
  642.  {
  643.      _focused = focused;
  644. +#ifdef OPACITY
  645. +    updateOpacity();
  646. +#endif // OPACITY
  647.  }
  648.  
  649.  //! @brief Only sets _sticky to sticky.
  650. @@ -209,6 +250,16 @@
  651.      _sticky = sticky;
  652.  }
  653.  
  654. +#ifdef OPACITY
  655. +//! @brief Updates opaque state
  656. +void
  657. +PWinObj::setOpaque(bool opaque)
  658. +{
  659. +    _opaque = opaque;
  660. +    updateOpacity();
  661. +}
  662. +#endif // OPACITY
  663. +
  664.  //! @brief Only sets _hidden to hidden.
  665.  void
  666.  PWinObj::setHidden(bool hidden)
  667. diff -Naur pekwm-0.1.12-ori/src/PWinObj.hh pekwm-0.1.12/src/PWinObj.hh
  668. --- pekwm-0.1.12-ori/src/PWinObj.hh     2010-06-07 13:25:03.145468666 +0200
  669. +++ pekwm-0.1.12/src/PWinObj.hh 2010-06-07 18:42:22.525468558 +0200
  670. @@ -119,10 +119,18 @@
  671.      inline bool isFocused(void) const { return _focused; }
  672.      //! @brief Returns sticky state of PWinObj.
  673.      inline bool isSticky(void) const { return _sticky; }
  674. -
  675.      //! @brief Returns Focusable state of PWinObj.
  676.      inline bool isFocusable(void) const { return _focusable; }
  677.  
  678. +#ifdef OPACITY
  679. +    //! @brief Returns transparency state of PWinObj
  680. +    inline bool isOpaque(void) const { return _opaque; }
  681. +    void setOpacity(ulong focused, ulong unfocused, bool enabled=true);
  682. +    inline void setOpacity(ulong value) { setOpacity(value, value); }
  683. +    inline void setOpacity(PWinObj *child) { setOpacity(child->_opacity.focused, child->_opacity.unfocused, !child->_opaque); }
  684. +    void updateOpacity(void);
  685. +#endif // OPACITY
  686. +
  687.      // interface
  688.      virtual void mapWindow(void);
  689.      virtual void mapWindowRaised(void);
  690. @@ -142,6 +150,9 @@
  691.      virtual void setLayer(uint layer);
  692.      virtual void setFocused(bool focused);
  693.      virtual void setSticky(bool sticky);
  694. +#ifdef OPACITY
  695. +    virtual void setOpaque(bool opaque);
  696. +#endif // OPACITY
  697.      /** Set focusable flag. */
  698.      virtual void setFocusable(bool focusable) { _focusable = focusable; }
  699.      virtual void setHidden(bool hidden);
  700. @@ -209,6 +220,18 @@
  701.      PWinObj *_parent; //!< Parent PWinObj.
  702.  
  703.      Type _type; //!< Type of PWinObj.
  704. +#ifdef OPACITY
  705. +    // Opacity information
  706. +    class Opacity {
  707. +    public:
  708. +        Opacity(void)
  709. +            : current(EWMH_OPAQUE_WINDOW),
  710. +              focused(EWMH_OPAQUE_WINDOW),
  711. +              unfocused(EWMH_OPAQUE_WINDOW) { }
  712. +        ulong current,focused,unfocused;
  713. +        ~Opacity(void) { }
  714. +    } _opacity;
  715. +#endif // OPACITY
  716.  
  717.      Geometry _gm; //!< Geometry of PWinObj (always in absolute coordinates).
  718.      uint _workspace; //!< Workspace PWinObj is on.
  719. @@ -219,7 +242,9 @@
  720.      bool _focused; //!< Focused state of PWinObj.
  721.      bool _sticky; //!< Sticky state of PWinObj.
  722.      bool _focusable; //!< Focusable state of PWinObj.
  723. -
  724. +#ifdef OPACITY
  725. +    bool _opaque; //!< Opaque set state of PWinObj
  726. +#endif // OPACITY
  727.      static PWinObj *_root_wo; //!< Static root PWinObj pointer.
  728.      static PWinObj *_focused_wo; //!< Static focused PWinObj pointer.
  729.      static std::vector<PWinObj*> _wo_list; //!< List of PWinObjs.
  730. diff -Naur pekwm-0.1.12-ori/src/WorkspaceIndicator.cc pekwm-0.1.12/src/WorkspaceIndicator.cc
  731. --- pekwm-0.1.12-ori/src/WorkspaceIndicator.cc  2010-06-07 13:25:03.146469163 +0200
  732. +++ pekwm-0.1.12/src/WorkspaceIndicator.cc      2010-06-07 18:42:22.526468773 +0200
  733. @@ -201,6 +201,10 @@
  734.      Workspaces::instance()->insert(this);
  735.      woListAdd(this);
  736.      _wo_map[_window] = this;
  737. +
  738. +#ifdef OPACITY
  739. +    setOpacity(Config::instance()->getWorkspaceIndicatorOpacity());
  740. +#endif // OPACITY
  741.  }
  742.  
  743.  /**
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: