diff -Naur pekwm-0.1.12-ori/configure pekwm-0.1.12/configure
--- pekwm-0.1.12-ori/configure 2010-04-07 00:24:11.000000000 +0200
+++ pekwm-0.1.12/configure 2010-06-07 13:21:29.373468039 +0200
@@ -768,6 +768,7 @@
enable_pedantic
enable_menus
enable_harbour
+enable_opacity
'
ac_precious_vars='build_alias
host_alias
@@ -1440,6 +1441,8 @@
--enable-pedantic turn on strict compile-time warnings default=no
--enable-menus include menu support default=yes
--enable-harbour include harbour default=yes
+ --enable-opacity enable opacity hinting for running under
+ composite managers default=no
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -9453,6 +9456,30 @@
$as_echo "no" >&6; }
fi
+
+{ $as_echo "$as_me:$LINENO: checking whether to include opacity hinting" >&5
+$as_echo_n "checking whether to include opacity hinting... " >&6; }
+# Check whether --enable-opacity was given.
+if test "${enable_opacity+set}" = set; then
+ enableval=$enable_opacity;
+else
+ enableval=no
+fi
+
+if test "x$enableval" = "xyes"; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define OPACITY 1
+_ACEOF
+
+ FEATURES="$FEATURES opacity"
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
EVO=`date`
cat >>confdefs.h <<_ACEOF
diff -Naur pekwm-0.1.12-ori/configure.ac pekwm-0.1.12/configure.ac
--- pekwm-0.1.12-ori/configure.ac 2010-04-07 00:23:55.000000000 +0200
+++ pekwm-0.1.12/configure.ac 2010-06-07 13:24:06.802467154 +0200
@@ -331,6 +331,20 @@
AC_MSG_RESULT([no])
fi
+dnl Check whether to include opacity hinting
+AC_MSG_CHECKING([whether to include opacity hinting])
+AC_ARG_ENABLE(opacity,
+ AC_HELP_STRING([--enable-opacity],
+ [include opacity hinting [default=no]]), ,
+ [enableval=no])
+if test "x$enableval" = "xyes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(OPACITY, [1], [Define to 1 to compile in support for opacity hinting])
+ FEATURES="$FEATURES opacity"
+else
+ AC_MSG_RESULT([no])
+fi
+
dnl define build info
EVO=`date`
AC_DEFINE_UNQUOTED(FEATURES, "$FEATURES", [Build info, do not touch])
diff -Naur pekwm-0.1.12-ori/src/ActionHandler.cc pekwm-0.1.12/src/ActionHandler.cc
--- pekwm-0.1.12-ori/src/ActionHandler.cc 2010-06-07 13:25:03.101468702 +0200
+++ pekwm-0.1.12/src/ActionHandler.cc 2010-06-07 18:42:22.513718656 +0200
@@ -239,6 +239,11 @@
case ACTION_ATTACH_FRAME_IN_PREV_FRAME:
WindowManager::instance()->attachInNextPrevFrame(client, true, false);
break;
+#ifdef OPACITY
+ case ACTION_SET_OPACITY:
+ actionSetOpacity(client, frame, it->getParamI(0), it->getParamI(1));
+ break;
+#endif // OPACITY
default:
matched = false;
break;
@@ -461,6 +466,11 @@
case ACTION_STATE_TITLE:
frame->setStateTitle(sa, client, Util::to_wide_str(action.getParamS()));
break;
+#ifdef OPACITY
+ case ACTION_STATE_OPAQUE:
+ frame->setStateOpaque(sa);
+ break;
+#endif // OPACITY
default:
matched = false;
break;
@@ -828,6 +838,19 @@
return true;
}
+#ifdef OPACITY
+void
+ActionHandler::actionSetOpacity(PWinObj *client, PWinObj *frame, int focus, int unfocus)
+{
+ if (!unfocus)
+ unfocus = focus;
+ std::cerr << "setting opacity to " << focus << "/" << unfocus << std::endl;
+ client->setOpacity(Config::parseOpacity(focus/100.),
+ Config::parseOpacity(unfocus/100.));
+ frame->setOpacity(client);
+}
+#endif // OPACITY
+
#ifdef MENUS
//! @brief Toggles visibility of menu.
//! @param name Name of menu to toggle visibilty of
diff -Naur pekwm-0.1.12-ori/src/ActionHandler.hh pekwm-0.1.12/src/ActionHandler.hh
--- pekwm-0.1.12-ori/src/ActionHandler.hh 2010-06-07 13:25:03.102468569 +0200
+++ pekwm-0.1.12/src/ActionHandler.hh 2010-06-07 18:42:22.513718656 +0200
@@ -52,6 +52,9 @@
void actionFocusToggle(uint button, uint raise, int off, bool show_iconified, bool mru);
void actionFocusDirectional(PWinObj *wo, DirectionType dir, bool raise);
bool actionSendKey(PWinObj *wo, const std::string &key_str);
+#ifdef OPACITY
+ void actionSetOpacity(PWinObj *client, PWinObj *frame, int focus, int unfocus);
+#endif // OPACITY
#ifdef MENUS
void actionShowMenu(const std::string &name, bool stick, uint e_type, PWinObj *wo_ref);
#endif // MENUS
diff -Naur pekwm-0.1.12-ori/src/Action.hh pekwm-0.1.12/src/Action.hh
--- pekwm-0.1.12-ori/src/Action.hh 2010-06-07 13:25:03.100468765 +0200
+++ pekwm-0.1.12/src/Action.hh 2010-06-07 18:42:22.512719279 +0200
@@ -76,6 +76,7 @@
ACTION_HIDE_WORKSPACE_INDICATOR,
ACTION_SEND_KEY,
+ ACTION_SET_OPACITY,
ACTION_NO
};
@@ -88,7 +89,7 @@
ACTION_STATE_DECOR, ACTION_STATE_TITLE,
ACTION_STATE_ICONIFIED, ACTION_STATE_TAGGED,
ACTION_STATE_MARKED, ACTION_STATE_SKIP,
- ACTION_STATE_CFG_DENY,
+ ACTION_STATE_CFG_DENY, ACTION_STATE_OPAQUE,
#ifdef HARBOUR
ACTION_STATE_HARBOUR_HIDDEN,
diff -Naur pekwm-0.1.12-ori/src/Atoms.cc pekwm-0.1.12/src/Atoms.cc
--- pekwm-0.1.12-ori/src/Atoms.cc 2010-06-07 13:25:03.102468569 +0200
+++ pekwm-0.1.12/src/Atoms.cc 2010-06-07 18:42:22.514740942 +0200
@@ -35,6 +35,7 @@
"_NET_WM_ICON_NAME", "_NET_WM_VISIBLE_ICON_NAME",
"_NET_WM_ICON", "_NET_WM_DESKTOP",
"_NET_WM_STRUT", "_NET_WM_PID",
+ "_NET_WM_WINDOW_OPACITY",
"_NET_WM_WINDOW_TYPE",
"_NET_WM_WINDOW_TYPE_DESKTOP", "_NET_WM_WINDOW_TYPE_DOCK",
diff -Naur pekwm-0.1.12-ori/src/Atoms.hh pekwm-0.1.12/src/Atoms.hh
--- pekwm-0.1.12-ori/src/Atoms.hh 2010-06-07 13:25:03.103468786 +0200
+++ pekwm-0.1.12/src/Atoms.hh 2010-06-07 18:42:22.514740942 +0200
@@ -37,6 +37,7 @@
NET_WM_ICON_NAME, NET_WM_VISIBLE_ICON_NAME,
NET_WM_ICON, NET_WM_DESKTOP,
NET_WM_STRUT, NET_WM_PID,
+ NET_WM_WINDOW_OPACITY,
WINDOW_TYPE,
WINDOW_TYPE_DESKTOP, WINDOW_TYPE_DOCK,
diff -Naur pekwm-0.1.12-ori/src/AutoProperties.cc pekwm-0.1.12/src/AutoProperties.cc
--- pekwm-0.1.12-ori/src/AutoProperties.cc 2010-06-07 13:25:03.104468654 +0200
+++ pekwm-0.1.12/src/AutoProperties.cc 2010-06-07 18:42:22.515723558 +0200
@@ -75,6 +75,7 @@
_property_map["FOCUSNEW"] = AP_FOCUS_NEW;
_property_map["FOCUSABLE"] = AP_FOCUSABLE;
_property_map["CFGDENY"] = AP_CFG_DENY;
+ _property_map["OPACITY"] = AP_OPACITY;
// group properties
_group_property_map[""] = AP_NO_PROPERTY;
@@ -824,7 +825,12 @@
}
}
break;
-
+#ifdef OPACITY
+ case AP_OPACITY:
+ prop->maskAdd(AP_OPACITY);
+ Config::parseOpacity((*it)->get_value(), prop->focus_opacity, prop->unfocus_opacity);
+ break;
+#endif // OPACITY
default:
// do nothing
break;
diff -Naur pekwm-0.1.12-ori/src/AutoProperties.hh pekwm-0.1.12/src/AutoProperties.hh
--- pekwm-0.1.12-ori/src/AutoProperties.hh 2010-06-07 13:25:03.105468732 +0200
+++ pekwm-0.1.12/src/AutoProperties.hh 2010-06-07 18:42:22.516466335 +0200
@@ -44,6 +44,7 @@
AP_FOCUS_NEW = (1L << 15),
AP_FOCUSABLE = (1L << 16),
AP_CFG_DENY = (1L << 17),
+ AP_OPACITY = (1L << 18),
AP_GROUP_SIZE,
AP_GROUP_BEHIND,
@@ -147,6 +148,9 @@
bool border, titlebar;
bool focusable, place_new, focus_new;
uint workspace, layer, skip, cfg_deny;
+#ifdef OPACITY
+ ulong focus_opacity, unfocus_opacity;
+#endif //OPACITY
std::string frame_decor;
diff -Naur pekwm-0.1.12-ori/src/Client.cc pekwm-0.1.12/src/Client.cc
--- pekwm-0.1.12-ori/src/Client.cc 2010-06-07 13:25:03.107468676 +0200
+++ pekwm-0.1.12/src/Client.cc 2010-06-07 18:42:22.517466272 +0200
@@ -1005,6 +1005,10 @@
if (ap->isMask(AP_CFG_DENY)) {
_state.cfg_deny = ap->cfg_deny;
}
+#ifdef OPACITY
+ if (ap->isMask(AP_OPACITY))
+ setOpacity(ap->focus_opacity, ap->unfocus_opacity);
+#endif // OPACITY
}
/**
diff -Naur pekwm-0.1.12-ori/src/Config.cc pekwm-0.1.12/src/Config.cc
--- pekwm-0.1.12-ori/src/Config.cc 2010-06-07 13:25:03.112468292 +0200
+++ pekwm-0.1.12/src/Config.cc 2010-06-07 18:42:22.519467401 +0200
@@ -93,6 +93,9 @@
_screen_show_status_window(true), _screen_show_status_window_on_root(false),
_screen_show_client_id(false),
_screen_show_workspace_indicator(500), _screen_workspace_indicator_scale(16),
+#ifdef OPACITY
+ _screen_workspace_indicator_opacity(EWMH_OPAQUE_WINDOW),
+#endif // OPACITY
_screen_place_new(true), _screen_focus_new(false),
_screen_focus_new_child(true), _screen_honour_randr(true),
_screen_honour_aspectratio(true),
@@ -103,12 +106,19 @@
_screen_client_unique_name_pre(" #"), _screen_client_unique_name_post(""),
_menu_select_mask(0), _menu_enter_mask(0), _menu_exec_mask(0),
_menu_display_icons(true),
+#ifdef OPACITY
+ _menu_focus_opacity(EWMH_OPAQUE_WINDOW),
+ _menu_unfocus_opacity(EWMH_OPAQUE_WINDOW),
+#endif // OPACITY
_cmd_dialog_history_unique(true), _cmd_dialog_history_size(1024),
_cmd_dialog_history_file("~/.pekwm/history"), _cmd_dialog_history_save_interval(16)
#ifdef HARBOUR
,_harbour_da_min_s(0), _harbour_da_max_s(0),
_harbour_ontop(true), _harbour_maximize_over(false),
_harbour_placement(TOP), _harbour_orientation(TOP_TO_BOTTOM), _harbour_head_nr(0)
+#ifdef OPACITY
+ ,_harbour_opacity(EWMH_OPAQUE_WINDOW)
+#endif // OPACITY
#endif // HARBOUR
{
if (_instance) {
@@ -174,6 +184,9 @@
_action_map["Dynamic"] = pair<ActionType, uint>(ACTION_MENU_DYN, ROOTMENU_OK|WINDOWMENU_OK);
#endif // MENUS
_action_map["SendKey"] = pair<ActionType, uint>(ACTION_SEND_KEY, ANY_MASK);
+#ifdef OPACITY
+ _action_map["SetOpacity"] = pair<ActionType, uint>(ACTION_SET_OPACITY, FRAME_MASK);
+#endif // OPACITY
_placement_map[""] = PLACE_NO;
_placement_map["SMART"] = PLACE_SMART;
@@ -305,6 +318,7 @@
_action_state_map["Marked"] = ACTION_STATE_MARKED;
_action_state_map["Skip"] = ACTION_STATE_SKIP;
_action_state_map["CfgDeny"] = ACTION_STATE_CFG_DENY;
+ _action_state_map["Opaque"] = ACTION_STATE_OPAQUE;
_action_state_map["Title"] = ACTION_STATE_TITLE;
#ifdef HARBOUR
_action_state_map["HarbourHidden"] = ACTION_STATE_HARBOUR_HIDDEN;
@@ -587,6 +601,10 @@
_screen_show_workspace_indicator, 500, 0));
key_list.push_back(new CfgParserKeyNumeric<int>("WORKSPACEINDICATORSCALE",
_screen_workspace_indicator_scale, 16, 2));
+#ifdef OPACITY
+ key_list.push_back(new CfgParserKeyNumeric<float>("WORKSPACEINDICATOROPACITY",
+ _screen_workspace_indicator_opacity, 1.0, 0, 1.0));
+#endif
key_list.push_back(new CfgParserKeyBool("PLACENEW", _screen_place_new));
key_list.push_back(new CfgParserKeyBool("FOCUSNEW", _screen_focus_new));
key_list.push_back(new CfgParserKeyBool("FOCUSNEWCHILD", _screen_focus_new_child, true));
@@ -700,6 +718,10 @@
key_list.push_back(new CfgParserKeyString("ENTER", value_enter, "BUTTONPRESS", 0));
key_list.push_back(new CfgParserKeyString("EXEC", value_exec, "BUTTONRELEASE", 0));
key_list.push_back(new CfgParserKeyBool("DISPLAYICONS", _menu_display_icons, true));
+#ifdef OPACITY
+ key_list.push_back(new CfgParserKeyNumeric<float>("FOCUSOPACITY", _menu_focus_opacity, 1.0, 0.0, 1.0));
+ key_list.push_back(new CfgParserKeyNumeric<float>("UNFOCUSOPACITY", _menu_unfocus_opacity, 1.0, 0.0, 1.0));
+#endif // OPACITY
// Parse data
section->parse_key_values(key_list.begin(), key_list.end());
@@ -787,6 +809,9 @@
key_list.push_back(new CfgParserKeyNumeric<int>("HEAD", _harbour_head_nr, 0, 0));
key_list.push_back(new CfgParserKeyString("PLACEMENT", value_placement, "RIGHT", 0));
key_list.push_back(new CfgParserKeyString("ORIENTATION", value_orientation, "TOPTOBOTTOM", 0));
+#ifdef OPACITY
+ key_list.push_back(new CfgParserKeyNumeric<float>("OPACITY", _harbour_opacity, 1.0, 0.0, 1.0));
+#endif // OPACITY
// Parse data
section->parse_key_values(key_list.begin(), key_list.end());
@@ -1042,6 +1067,18 @@
}
break;
#endif // MENUS
+#ifdef OPACITY
+ case ACTION_SET_OPACITY:
+ if ((Util::splitString(tok[1], tok, " \t", 2)) == 2) {
+ action.setParamI(0, (int)(100*atof(tok[tok.size() - 2].c_str())));
+
+ action.setParamI(1, (int)(100*atof(tok[tok.size() - 1].c_str())));
+ } else {
+ action.setParamI(0, (int)(100*atof(tok[1].c_str())));
+ action.setParamI(1, (int)(100*atof(tok[1].c_str())));
+ }
+ break;
+#endif // OPACITY
default:
// do nothing
break;
@@ -1792,3 +1829,42 @@
return num;
}
+
+ulong
+Config::parseOpacity(double value)
+{
+ if (value >= 1.0)
+ return EWMH_OPAQUE_WINDOW;
+ return (ulong)(value*EWMH_OPAQUE_WINDOW);
+}
+
+ulong
+Config::parseOpacity(const std::string value)
+{
+ double opacity = atof(value.c_str());
+ if (opacity > 1.0)
+ opacity = 1.0;
+ else if (opacity < 0.0)
+ opacity = 0.0;
+ return Config::parseOpacity(opacity);
+}
+
+//! @brief Parses a string which contains two opacity values
+bool
+Config::parseOpacity(const std::string value, ulong &focused, ulong &unfocused)
+{
+ std::vector<string> tokens;
+ switch ((Util::splitString(value, tokens, " ,", 2))) {
+ case 2:
+ focused = parseOpacity(tokens.at(0));
+ unfocused = parseOpacity(tokens.at(1));
+ break;
+ case 1:
+ focused = unfocused =
+ parseOpacity(tokens.at(0));
+ break;
+ default:
+ return false;
+ }
+ return true;
+}
diff -Naur pekwm-0.1.12-ori/src/Config.hh pekwm-0.1.12/src/Config.hh
--- pekwm-0.1.12-ori/src/Config.hh 2010-06-07 13:25:03.113468788 +0200
+++ pekwm-0.1.12/src/Config.hh 2010-06-07 18:42:22.520466639 +0200
@@ -141,6 +141,9 @@
inline bool isShowClientID(void) const { return _screen_show_client_id; }
int getShowWorkspaceIndicator(void) const { return _screen_show_workspace_indicator; }
int getWorkspaceIndicatorScale(void) const { return _screen_workspace_indicator_scale; }
+#ifdef OPACITY
+ ulong getWorkspaceIndicatorOpacity(void) { return Config::parseOpacity(_screen_workspace_indicator_opacity); }
+#endif // OPACITY
inline bool isPlaceNew(void) const { return _screen_place_new; }
inline bool isFocusNew(void) const { return _screen_focus_new; }
inline bool isFocusNewChild(void) const { return _screen_focus_new_child; }
@@ -168,6 +171,10 @@
inline bool isMenuEnterOn(uint val) const { return (_menu_enter_mask&val); }
inline bool isMenuExecOn(uint val) const { return (_menu_exec_mask&val); }
bool isDisplayMenuIcons(void) const { return _menu_display_icons; }
+#ifdef OPACITY
+ inline ulong getMenuFocusOpacity(void) { return Config::parseOpacity(_menu_focus_opacity); }
+ inline ulong getMenuUnfocusOpacity(void) { return Config::parseOpacity(_menu_unfocus_opacity); }
+#endif // OPACITY
bool isCmdDialogHistoryUnique(void) const { return _cmd_dialog_history_unique; }
int getCmdDialogHistorySize(void) const { return _cmd_dialog_history_size; }
@@ -182,6 +189,9 @@
inline bool isHarbourMaximizeOver(void) const { return _harbour_maximize_over; }
inline uint getHarbourPlacement(void) const { return _harbour_placement; }
inline uint getHarbourOrientation(void) const { return _harbour_orientation; }
+#ifdef OPACITY
+ inline ulong getHarbourOpacity(void) { return Config::parseOpacity(_harbour_opacity); }
+#endif // OPACITY
#endif // HARBOUR
inline std::list<ActionEvent> *getMouseActionList(MouseActionListName name)
@@ -238,6 +248,9 @@
inline uint getMod(const std::string &mod) { return ParseUtil::getValue<uint>(mod, _mod_map); }
uint getMouseButton(const std::string& button);
+ static bool parseOpacity(const std::string value, ulong &focused, ulong &unfocused);
+ static ulong parseOpacity(double value);
+
private:
bool tryHardLoadConfig(CfgParser &cfg, std::string &file);
void copyConfigFiles(void);
@@ -255,6 +268,7 @@
void parseButtons(CfgParser::Entry *section, std::list<ActionEvent>* mouse_list, ActionOk action_ok);
int parseWorkspaceNumber(const std::string &workspace);
+ static ulong parseOpacity(const std::string value);
private:
std::string _config_file; /**< Path to config file last loaded. */
@@ -289,6 +303,9 @@
bool _screen_show_client_id; //!< Flag to display client ID in title.
int _screen_show_workspace_indicator; //!< Display workspace indicator for N seconds.
int _screen_workspace_indicator_scale; //!< Scale of the workspace indicator head
+#ifdef OPACITY
+ float _screen_workspace_indicator_opacity;
+#endif // OPACITY
bool _screen_place_new, _screen_focus_new, _screen_focus_new_child;
bool _screen_honour_randr; /**< Boolean flag if randr information should be honoured. */
bool _screen_honour_aspectratio; /**< if true, pekwm keeps aspect ratio (XSizeHint) */
@@ -300,6 +317,9 @@
uint _menu_select_mask, _menu_enter_mask, _menu_exec_mask;
bool _menu_display_icons; /**< Boolean flag, when true display icons in menus. */
+#ifdef OPACITY
+ float _menu_focus_opacity, _menu_unfocus_opacity;
+#endif // OPACITY
std::map<std::string, SizeLimits> _menu_icon_limits; /**< Map of name -> limit for icons in menus */
@@ -316,6 +336,9 @@
uint _harbour_placement;
uint _harbour_orientation;
int _harbour_head_nr;
+#ifdef OPACITY
+ float _harbour_opacity;
+#endif // OPACITY
#endif // HARBOUR
std::map<MouseActionListName, std::list<ActionEvent>* > _mouse_action_map;
diff -Naur pekwm-0.1.12-ori/src/Frame.cc pekwm-0.1.12/src/Frame.cc
--- pekwm-0.1.12-ori/src/Frame.cc 2010-06-07 13:25:03.139468343 +0200
+++ pekwm-0.1.12/src/Frame.cc 2010-06-07 18:42:22.521467414 +0200
@@ -466,6 +466,10 @@
_client->setShaped(setShape());
}
+#ifdef OPACITY
+ setOpacity(_client);
+#endif // OPACITY
+
if (_focused) {
child->giveInputFocus();
}
@@ -1686,6 +1690,17 @@
renderTitle();
}
+#ifdef OPACITY
+void
+Frame::setStateOpaque(StateAction sa)
+{
+ if (! ActionUtil::needToggle(sa, _opaque)) {
+ return;
+ }
+ _client->setOpaque(!_opaque);
+ setOpaque(!_opaque);
+}
+#endif // OPACITY
// STATE actions end
//! @brief
diff -Naur pekwm-0.1.12-ori/src/Frame.hh pekwm-0.1.12/src/Frame.hh
--- pekwm-0.1.12-ori/src/Frame.hh 2010-06-07 13:25:03.140468770 +0200
+++ pekwm-0.1.12/src/Frame.hh 2010-06-07 18:42:22.521467414 +0200
@@ -112,6 +112,9 @@
void setStateSkip(StateAction sa, uint skip);
void setStateTitle(StateAction sa, Client *client, const std::wstring &title);
void setStateMarked(StateAction sa, Client *client);
+#ifdef OPACITY
+ void setStateOpaque(StateAction sa);
+#endif // OPACITY
void close(void);
diff -Naur pekwm-0.1.12-ori/src/Harbour.cc pekwm-0.1.12/src/Harbour.cc
--- pekwm-0.1.12-ori/src/Harbour.cc 2010-06-07 13:25:03.142468504 +0200
+++ pekwm-0.1.12/src/Harbour.cc 2010-06-07 18:42:22.523466938 +0200
@@ -50,7 +50,9 @@
_strut = new Strut();
_scr->addStrut(_strut);
_strut->head = Config::instance()->getHarbourHead();
-
+#ifdef OPACITY
+ _opacity = Config::instance()->getHarbourOpacity();
+#endif
#ifdef MENUS
_harbour_menu = new HarbourMenu(_scr, _theme, this);
#endif // MENUS
@@ -96,6 +98,9 @@
da->mapWindow();
}
+#ifdef OPACITY
+ da->setOpacity(_opacity);
+#endif
updateHarbourSize();
}
diff -Naur pekwm-0.1.12-ori/src/Harbour.hh pekwm-0.1.12/src/Harbour.hh
--- pekwm-0.1.12-ori/src/Harbour.hh 2010-06-07 13:25:03.142468504 +0200
+++ pekwm-0.1.12/src/Harbour.hh 2010-06-07 18:42:22.523466938 +0200
@@ -87,6 +87,9 @@
uint _size;
Strut *_strut;
int _last_button_x, _last_button_y;
+#ifdef OPACITY
+ ulong _opacity;
+#endif // OPACITY
};
#endif // _HARBOUR_HH_
diff -Naur pekwm-0.1.12-ori/src/pekwm.hh pekwm-0.1.12/src/pekwm.hh
--- pekwm-0.1.12-ori/src/pekwm.hh 2010-06-07 13:25:03.146469163 +0200
+++ pekwm-0.1.12/src/pekwm.hh 2010-06-07 18:42:22.526468773 +0200
@@ -86,6 +86,7 @@
// defines... eek
#define NET_WM_STICKY_WINDOW 0xffffffff
+#define EWMH_OPAQUE_WINDOW 0xffffffff
// enums
enum Layer {
diff -Naur pekwm-0.1.12-ori/src/PMenu.cc pekwm-0.1.12/src/PMenu.cc
--- pekwm-0.1.12-ori/src/PMenu.cc 2010-06-07 13:25:03.143468651 +0200
+++ pekwm-0.1.12/src/PMenu.cc 2010-06-07 18:42:22.524469599 +0200
@@ -106,6 +106,10 @@
_menu_map[_window] = this; // add to menu map
woListAdd(this);
_wo_map[_window] = this;
+#ifdef OPACITY
+ setOpacity(Config::instance()->getMenuFocusOpacity(),
+ Config::instance()->getMenuUnfocusOpacity());
+#endif
}
//! @brief Destructor for PMenu class
diff -Naur pekwm-0.1.12-ori/src/PWinObj.cc pekwm-0.1.12/src/PWinObj.cc
--- pekwm-0.1.12-ori/src/PWinObj.cc 2010-06-07 13:25:03.144468518 +0200
+++ pekwm-0.1.12/src/PWinObj.cc 2010-06-07 18:42:22.525468558 +0200
@@ -15,6 +15,10 @@
#include "PWinObj.hh"
+#ifdef OPACITY
+#include "Atoms.hh"
+#endif // OPACITY
+
using std::cerr;
using std::endl;
using std::find;
@@ -34,6 +38,9 @@
_mapped(false), _iconified(false), _hidden(false),
_focused(false), _sticky(false),
_focusable(true)
+#ifdef OPACITY
+ ,_opaque(true)
+#endif // OPACITY
{
}
@@ -63,6 +70,37 @@
}
}
+#ifdef OPACITY
+//! @brief Sets the desired opacity values for focused/unfocused states
+void
+PWinObj::setOpacity(ulong focused, ulong unfocused, bool enabled)
+{
+ _opacity.focused = focused;
+ _opacity.unfocused = unfocused;
+ _opaque = !enabled;
+ updateOpacity();
+}
+
+//! @brief Updates the opacity Xhint based on focused state
+void
+PWinObj::updateOpacity(void)
+{
+ ulong opacity;
+ if (_opaque)
+ opacity = EWMH_OPAQUE_WINDOW;
+ else
+ opacity = isFocused()?_opacity.focused:_opacity.unfocused;
+
+ if (_opacity.current != opacity) {
+ _opacity.current = opacity;
+ XChangeProperty(_dpy, _window,
+ Atoms::getAtom(NET_WM_WINDOW_OPACITY),
+ XA_CARDINAL,
+ 32, PropModeReplace, (uchar*) &opacity, 1);
+ }
+}
+#endif // OPACITY
+
//! @brief Maps the window and sets _mapped to true.
void
PWinObj::mapWindow(void)
@@ -195,11 +233,14 @@
_layer = layer;
}
-//! @brief Only sets _focused to focused.
+//! @brief Sets _focused to focused and updates opacity as needed.
void
PWinObj::setFocused(bool focused)
{
_focused = focused;
+#ifdef OPACITY
+ updateOpacity();
+#endif // OPACITY
}
//! @brief Only sets _sticky to sticky.
@@ -209,6 +250,16 @@
_sticky = sticky;
}
+#ifdef OPACITY
+//! @brief Updates opaque state
+void
+PWinObj::setOpaque(bool opaque)
+{
+ _opaque = opaque;
+ updateOpacity();
+}
+#endif // OPACITY
+
//! @brief Only sets _hidden to hidden.
void
PWinObj::setHidden(bool hidden)
diff -Naur pekwm-0.1.12-ori/src/PWinObj.hh pekwm-0.1.12/src/PWinObj.hh
--- pekwm-0.1.12-ori/src/PWinObj.hh 2010-06-07 13:25:03.145468666 +0200
+++ pekwm-0.1.12/src/PWinObj.hh 2010-06-07 18:42:22.525468558 +0200
@@ -119,10 +119,18 @@
inline bool isFocused(void) const { return _focused; }
//! @brief Returns sticky state of PWinObj.
inline bool isSticky(void) const { return _sticky; }
-
//! @brief Returns Focusable state of PWinObj.
inline bool isFocusable(void) const { return _focusable; }
+#ifdef OPACITY
+ //! @brief Returns transparency state of PWinObj
+ inline bool isOpaque(void) const { return _opaque; }
+ void setOpacity(ulong focused, ulong unfocused, bool enabled=true);
+ inline void setOpacity(ulong value) { setOpacity(value, value); }
+ inline void setOpacity(PWinObj *child) { setOpacity(child->_opacity.focused, child->_opacity.unfocused, !child->_opaque); }
+ void updateOpacity(void);
+#endif // OPACITY
+
// interface
virtual void mapWindow(void);
virtual void mapWindowRaised(void);
@@ -142,6 +150,9 @@
virtual void setLayer(uint layer);
virtual void setFocused(bool focused);
virtual void setSticky(bool sticky);
+#ifdef OPACITY
+ virtual void setOpaque(bool opaque);
+#endif // OPACITY
/** Set focusable flag. */
virtual void setFocusable(bool focusable) { _focusable = focusable; }
virtual void setHidden(bool hidden);
@@ -209,6 +220,18 @@
PWinObj *_parent; //!< Parent PWinObj.
Type _type; //!< Type of PWinObj.
+#ifdef OPACITY
+ // Opacity information
+ class Opacity {
+ public:
+ Opacity(void)
+ : current(EWMH_OPAQUE_WINDOW),
+ focused(EWMH_OPAQUE_WINDOW),
+ unfocused(EWMH_OPAQUE_WINDOW) { }
+ ulong current,focused,unfocused;
+ ~Opacity(void) { }
+ } _opacity;
+#endif // OPACITY
Geometry _gm; //!< Geometry of PWinObj (always in absolute coordinates).
uint _workspace; //!< Workspace PWinObj is on.
@@ -219,7 +242,9 @@
bool _focused; //!< Focused state of PWinObj.
bool _sticky; //!< Sticky state of PWinObj.
bool _focusable; //!< Focusable state of PWinObj.
-
+#ifdef OPACITY
+ bool _opaque; //!< Opaque set state of PWinObj
+#endif // OPACITY
static PWinObj *_root_wo; //!< Static root PWinObj pointer.
static PWinObj *_focused_wo; //!< Static focused PWinObj pointer.
static std::vector<PWinObj*> _wo_list; //!< List of PWinObjs.
diff -Naur pekwm-0.1.12-ori/src/WorkspaceIndicator.cc pekwm-0.1.12/src/WorkspaceIndicator.cc
--- pekwm-0.1.12-ori/src/WorkspaceIndicator.cc 2010-06-07 13:25:03.146469163 +0200
+++ pekwm-0.1.12/src/WorkspaceIndicator.cc 2010-06-07 18:42:22.526468773 +0200
@@ -201,6 +201,10 @@
Workspaces::instance()->insert(this);
woListAdd(this);
_wo_map[_window] = this;
+
+#ifdef OPACITY
+ setOpacity(Config::instance()->getWorkspaceIndicatorOpacity());
+#endif // OPACITY
}
/**