Rationale:
Claes ran successfully pekwm under gnome without the session management code.
The session code didn't actually load/save the session and therefore it is
removed for 0.1.11. Should it cause any regressions under gnome I'll re-add it.
| configure.ac | |
| 67 | @@ -67,23 +67,6 @@ |
| 67 | CONFIGOPTS="$CONFIGOPTS --disable-shape" |
| 68 | fi |
| 69 | |
| 70 | dnl Check for session support |
| 71 | AC_MSG_CHECKING([whether to build session support]) |
| 72 | AC_ARG_ENABLE(session, |
| 73 | AC_HELP_STRING([--enable-session], |
| 74 | [enable session support [default=yes]]), , |
| 75 | [enable_session=yes]) |
| 76 | if test "x$enable_session" = "xyes"; then |
| 77 | AC_MSG_RESULT([yes]) |
| 78 | AC_CHECK_LIB(SM, SmcOpenConnection, |
| 79 | AC_DEFINE(HAVE_SESSION, [1], [Define to 1 if you want session support]) |
| 80 | LIBS="$LIBS -lSM" |
| 81 | FEATURES="$FEATURES session") |
| 82 | else |
| 83 | AC_MSG_RESULT([no]) |
| 84 | fi |
| 85 | AM_CONDITIONAL([HAVE_SESSION], [test "x$ac_cv_lib_SM_SmcOpenConnection" = "xyes"]) |
| 86 | |
| 87 | dnl Check for Xinerama support |
| 88 | AC_MSG_CHECKING([whether to build support for the Xinerama extension]) |
| 89 | AC_ARG_ENABLE(xinerama, |
| ... | |
| src/WindowManager.cc | |
| 143 | @@ -143,24 +143,7 @@ |
| 143 | break; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | #ifdef HAVE_SESSION |
| 148 | /** |
| 149 | * Handler setting ice connections |
| 150 | */ |
| 151 | static void |
| 152 | iceWatch(IceConn ice_conn, IcePointer data, |
| 153 | Bool opening, IcePointer *watch_data) |
| 154 | { |
| 155 | if (opening) { |
| 156 | WindowManager::instance()->setIceConn(ice_conn); |
| 157 | WindowManager::instance()->setIceFd(IceConnectionNumber(ice_conn)); |
| 158 | } else { |
| 159 | WindowManager::instance()->setIceConn(0); |
| 160 | WindowManager::instance()->setIceFd(0); |
| 161 | } |
| 162 | } |
| 163 | #endif // HAVE_SESSION |
| 164 | |
| 165 | } // extern "C" |
| 166 | |
| 167 | |
| ... | |
| 207 | @@ -224,10 +207,6 @@ |
| 207 | #endif // HARBOUR |
| 208 | _cmd_dialog(0), _search_dialog(0), |
| 209 | _status_window(0), _workspace_indicator(0), |
| 227 | _max_fd(0), _dpy_fd(0), |
| 228 | #ifdef HAVE_SESSION |
| 229 | _ice_fd(0), _ice_conn(0), |
| 230 | #endif // HAVE_SESSION |
| 214 | _command_line(command_line), |
| 215 | _startup(false), _shutdown(false), _reload(false), |
| 216 | _allow_grouping(true), _hint_wo(0), _root_wo(0) |
| ... | |
| 368 | @@ -389,8 +368,6 @@ |
| 368 | |
| 369 | // Setup screen, init atoms and claim the display. |
| 370 | _screen = new PScreen(dpy, _config->isHonourRandr()); |
| 392 | _dpy_fd = ConnectionNumber(dpy); |
| 393 | _max_fd = _dpy_fd + 1; |
| 373 | |
| 374 | Atoms::init(); |
| 375 | |
| ... | |
| 777 | @@ -800,13 +777,8 @@ |
| 777 | WindowManager::doEventLoop(void) |
| 778 | { |
| 779 | XEvent ev; |
| 803 | bool is_xevent, is_icevent; |
| 781 | Timer<ActionPerformed>::timed_event_list events; |
| 782 | |
| 806 | #ifdef HAVE_SESSION |
| 807 | IceAddConnectionWatch(iceWatch, NULL); |
| 808 | #endif // HAVE_SESSION |
| 809 | |
| 787 | while (! _shutdown && ! is_signal_int_term) { |
| 788 | // Handle timeouts |
| 789 | if (is_signal_alrm) { |
| ... | |
| 799 | @@ -827,13 +799,8 @@ |
| 799 | doReload(); |
| 800 | } |
| 801 | |
| 830 | // Wait for IO |
| 831 | waitIO(is_xevent, is_icevent); |
| 832 | |
| 805 | // Get next event, drop event handling if none was given |
| 834 | if (is_xevent) { |
| 835 | XNextEvent(_screen->getDpy(), &ev); |
| 836 | |
| 809 | if (_screen->getNextEvent(ev)) { |
| 810 | switch (ev.type) { |
| 811 | case MapRequest: |
| 812 | handleMapRequestEvent(&ev.xmaprequest); |
| ... | |
| 887 | @@ -920,55 +887,6 @@ |
| 887 | break; |
| 888 | } |
| 889 | } |
| 923 | |
| 924 | #ifdef HAVE_SESSION |
| 925 | if (is_icevent) { |
| 926 | Bool dummy_b; |
| 927 | // Process messages, might not |
| 928 | IceProcessMessages(_ice_conn, NULL, &dummy_b); |
| 929 | } |
| 930 | #endif // HAVE_SESSION |
| 931 | } |
| 932 | |
| 933 | #ifdef HAVE_SESSION |
| 934 | IceRemoveConnectionWatch(iceWatch, NULL); |
| 935 | #endif // HAVE_SESSION |
| 936 | } |
| 937 | |
| 938 | /** |
| 939 | * Wait for data from connections. |
| 940 | */ |
| 941 | void |
| 942 | WindowManager::waitIO(bool &is_xevent, bool &is_iceevent) |
| 943 | { |
| 944 | is_xevent = is_iceevent = false; |
| 945 | |
| 946 | if (XPending(PScreen::instance()->getDpy()) > 0) { |
| 947 | is_xevent = true; |
| 948 | return; |
| 949 | } |
| 950 | |
| 951 | // Make sure to flush X11 connection before starting to wait or |
| 952 | // else we might end up waiting here forever. |
| 953 | XFlush(_screen->getDpy()); |
| 954 | |
| 955 | int ret; |
| 956 | fd_set rfds; |
| 957 | |
| 958 | FD_ZERO(&rfds); |
| 959 | FD_SET(_dpy_fd, &rfds); |
| 960 | #ifdef HAVE_SESSION |
| 961 | if (_ice_fd) { |
| 962 | FD_SET(_ice_fd, &rfds); |
| 963 | } |
| 964 | #endif // HAVE_SESSION |
| 965 | |
| 966 | ret = select(_max_fd, &rfds, 0, 0, 0); |
| 967 | if (ret > 0) { |
| 968 | is_xevent = FD_ISSET(_dpy_fd, &rfds); |
| 969 | #ifdef HAVE_SESSION |
| 970 | is_iceevent = FD_ISSET(_ice_fd, &rfds); |
| 971 | #endif // HAVE_SESSION |
| 939 | } |
| 940 | } |
| 941 | |
| ... | |
| src/WindowManager.hh | |
| 27 | @@ -27,14 +27,11 @@ |
| 27 | #include <list> |
| 28 | #include <map> |
| 29 | |
| 30 | extern "C" { |
| 31 | #ifdef HAVE_XRANDR |
| 32 | extern "C" { |
| 33 | #include <X11/extensions/Xrandr.h> |
| 34 | #endif // HAVE_XRANDR |
| 35 | #ifdef HAVE_SESSION |
| 36 | #include <X11/ICE/ICElib.h> |
| 37 | #endif // HAVE_SESSION |
| 38 | } |
| 39 | #endif // HAVE_XRANDR |
| 40 | |
| 41 | class ActionHandler; |
| 42 | class AutoProperties; |
| ... | |
| 80 | @@ -83,14 +80,6 @@ |
| 80 | /**< Return shutdown flag, set to tru to shutdown window manager. */ |
| 81 | bool *getShutdownFlag(void) { return &_shutdown; } |
| 82 | |
| 86 | #ifdef HAVE_SESSION |
| 87 | void setIceConn(IceConn ice_conn) { _ice_conn = ice_conn; } |
| 88 | void setIceFd(int ice_fd) { |
| 89 | _ice_fd = ice_fd; |
| 90 | _max_fd = std::max(_dpy_fd, _ice_fd) + 1; |
| 91 | } |
| 92 | #endif // HAVE_SESSION |
| 93 | |
| 91 | // get "base" classes |
| 92 | inline PScreen *getScreen(void) const { return _screen; } |
| 93 | inline Config *getConfig(void) const { return _config; } |
| ... | |
| 177 | @@ -188,8 +177,6 @@ |
| 177 | void scanWindows(void); |
| 178 | void execStartFile(void); |
| 179 | |
| 191 | void waitIO(bool &is_xevent, bool &is_iceevent); |
| 192 | |
| 182 | void doReload(void); |
| 183 | void doReloadConfig(void); |
| 184 | void doReloadTheme(void); |
| ... | |
| 267 | @@ -280,13 +267,6 @@ |
| 267 | static const unsigned int MENU_NAMES_RESERVED_COUNT; |
| 268 | #endif // MENUS |
| 269 | |
| 283 | int _max_fd; /**< Max file descriptor to select on. */ |
| 284 | int _dpy_fd; /**< Display file descriptor. */ |
| 285 | #ifdef HAVE_SESSION |
| 286 | int _ice_fd; /**< ICE file descriptor.*/ |
| 287 | IceConn _ice_conn; /**< Connection to ICE. */ |
| 288 | #endif // HAVE_SESSION |
| 289 | |
| 277 | std::string _command_line, _restart_command; |
| 278 | bool _startup; //!< Indicates startup status. |
| 279 | bool _shutdown; //!< Set to wheter we want to shutdown. |
| ... | |
| src/Makefile.am | |
| 61 | @@ -61,10 +61,6 @@ |
| 61 | main.cc \ |
| 62 | pekwm.hh |
| 63 | |
| 64 | if HAVE_SESSION |
| 65 | pekwm_SOURCES += Session.cc Session.hh |
| 66 | endif |
| 67 | |
| 68 | distclean-local: |
| 69 | rm -f *\~ .\#* |
| 70 | |
| ... | |
| src/PScreen.cc | |
| 117 | @@ -117,7 +117,7 @@ |
| 117 | |
| 118 | //! @brief PScreen constructor |
| 119 | PScreen::PScreen(Display *dpy, bool honour_randr) |
| 120 | : _dpy(dpy), _honour_randr(honour_randr), |
| 121 | : _dpy(dpy), _honour_randr(honour_randr), _fd(-1), |
| 122 | _screen(-1), _depth(-1), |
| 123 | _root(None), _visual(0), _colormap(None), |
| 124 | _modifier_map(0), |
| ... | |
| 136 | @@ -136,6 +136,7 @@ |
| 136 | |
| 137 | XGrabServer(_dpy); |
| 138 | |
| 139 | _fd = ConnectionNumber(dpy); |
| 140 | _screen = DefaultScreen(_dpy); |
| 141 | _root = RootWindow(_dpy, _screen); |
| 142 | |
| ... | |
| 199 | @@ -198,6 +199,33 @@ |
| 199 | _scroll_lock = getMaskFromKeycode(XKeysymToKeycode(_dpy, XK_Scroll_Lock)); |
| 200 | } |
| 201 | |
| 202 | //! @brief Get next event using select to avoid signal blocking |
| 203 | //! @param ev Event to fill in. |
| 204 | //! @return true if event was fetched, else false. |
| 205 | bool |
| 206 | PScreen::getNextEvent(XEvent &ev) |
| 207 | { |
| 208 | if (XPending(_dpy) > 0) { |
| 209 | XNextEvent(_dpy, &ev); |
| 210 | return true; |
| 211 | } |
| 212 | |
| 213 | int ret; |
| 214 | fd_set rfds; |
| 215 | |
| 216 | XFlush(_dpy); |
| 217 | |
| 218 | FD_ZERO(&rfds); |
| 219 | FD_SET(_fd, &rfds); |
| 220 | |
| 221 | ret = select(_fd + 1, &rfds, 0, 0, 0); |
| 222 | if (ret > 0) { |
| 223 | XNextEvent(_dpy, &ev); |
| 224 | } |
| 225 | |
| 226 | return ret > 0; |
| 227 | } |
| 228 | |
| 229 | //! @brief Grabs the server, counting number of grabs |
| 230 | bool |
| 231 | PScreen::grabServer(void) |
| ... | |
| src/PScreen.hh | |
| 163 | @@ -163,6 +163,7 @@ |
| 163 | inline int getEventXRandr(void) const { return _event_xrandr; } |
| 164 | #endif // HAVE_XRANDR |
| 165 | |
| 166 | bool getNextEvent(XEvent &ev); |
| 167 | bool grabServer(void); |
| 168 | bool ungrabServer(bool sync); |
| 169 | bool grabKeyboard(Window win); |
| ... | |
| 236 | @@ -235,6 +236,7 @@ |
| 236 | private: |
| 237 | Display *_dpy; |
| 238 | bool _honour_randr; /**< Boolean flag if randr should be honoured. */ |
| 239 | int _fd; |
| 240 | |
| 241 | int _screen, _depth; |
| 242 | |
| ... | |
| src/main.cc | |
| 21 | @@ -21,9 +21,6 @@ |
| 21 | #include "Frame.hh" |
| 22 | #include "WindowManager.hh" |
| 23 | #include "Util.hh" |
| 24 | #ifdef HAVE_SESSION |
| 25 | #include "Session.hh" |
| 26 | #endif // HAVE_SESSION |
| 27 | |
| 28 | #include <iostream> |
| 29 | #include <string> |
| ... | |
| 118 | @@ -121,18 +118,9 @@ |
| 118 | Info::printInfo(); |
| 119 | #endif // DEBUG |
| 120 | |
| 124 | // Setup session before starting pekwm |
| 125 | #ifdef HAVE_SESSION |
| 126 | Session *session = new Session(argc, argv); |
| 127 | #endif // HAVE_SESSION |
| 125 | WindowManager *wm = WindowManager::start(command_line, config_file, replace); |
| 126 | |
| 127 | if (wm) { |
| 131 | #ifdef HAVE_SESSION |
| 132 | // Hookup shutdown flag and run the main loop if window manager was |
| 133 | // created |
| 134 | session->setShutdownFlag(wm->getShutdownFlag()); |
| 135 | #endif // HAVE_SESSION |
| 133 | wm->doEventLoop(); |
| 134 | |
| 135 | // see if we wanted to restart |
| ... | |
| 129 | @@ -141,9 +129,6 @@ |
| 129 | |
| 130 | // cleanup before restarting |
| 131 | WindowManager::destroy(); |
| 144 | #ifdef HAVE_SESSION |
| 145 | delete session; |
| 146 | #endif // HAVE_SESSION |
| 135 | Util::iconv_deinit(); |
| 136 | |
| 137 | execlp("/bin/sh", "sh" , "-c", command.c_str(), (char*) 0); |
| ... | |
| 137 | @@ -152,9 +137,6 @@ |
| 137 | } |
| 138 | |
| 139 | // Cleanup |
| 155 | #ifdef HAVE_SESSION |
| 156 | delete session; |
| 157 | #endif // HAVE_SESSION |
| 143 | Util::iconv_deinit(); |
| 144 | |
| 145 | return 0; |
| ... | |