]> Dogcows Code - chaz/openbox/commitdiff
add a -single argument which only runs on a single screen
authorDana Jansens <danakj@orodu.net>
Wed, 8 Jan 2003 16:29:39 +0000 (16:29 +0000)
committerDana Jansens <danakj@orodu.net>
Wed, 8 Jan 2003 16:29:39 +0000 (16:29 +0000)
scripts/builtins.py
src/client.cc
src/openbox.cc
src/openbox.hh

index d87bf3d84dae560f7fb6f42daea57f36f16f26c6..9020859efc42b34b1e9135a95a86bbd199b9232d 100644 (file)
@@ -175,6 +175,25 @@ def send_to_prev_desktop(data, no_wrap=0, follow=1):
     send_to_desktop(data, d)
     if follow:
         change_desktop(data, d)
+
+def state_above(data, add=2):
+    """Toggles, adds or removes the 'above' state on a window."""
+    client = Openbox_findClient(openbox, data.window())
+    if not client: return
+    root = ScreenInfo_rootWindow(OBDisplay_screenInfo(data.screen()))
+    window = OBClient_window(client)
+    send_client_msg(root, OBProperty_net_wm_state, window, add,
+                    OBProperty_net_wm_state_above)
+    
+def state_below(data, add=2):
+    """Toggles, adds or removes the 'below' state on a window."""
+    client = Openbox_findClient(openbox, data.window())
+    if not client: return
+    root = ScreenInfo_rootWindow(OBDisplay_screenInfo(data.screen()))
+    window = OBClient_window(client)
+    print OBProperty_net_wm_state_below
+    send_client_msg(root, OBProperty_net_wm_state, window, add,
+                    OBProperty_net_wm_state_below)
     
 #########################################
 ### Convenience functions for scripts ###
index 2c6ec5e5fed561805218bcaf1c90df3bcf50e8f6..3b2a14387df3c88fee792e1674e21689d0ad2b45 100644 (file)
@@ -754,6 +754,7 @@ void OBClient::setState(StateAction action, long data1, long data2)
         _above = true;
       } else if (state ==
                  property->atom(otk::OBProperty::net_wm_state_below)) {
+        printf("Setting below\n");
         if (_below) continue;
         _below = true;
       }
@@ -897,7 +898,11 @@ void OBClient::clientMessageHandler(const XClientMessageEvent &e)
   } else if (e.message_type == property->atom(otk::OBProperty::net_wm_state)) {
     // can't compress these
 #ifdef DEBUG
-    printf("net_wm_state for 0x%lx\n", _window);
+    printf("below=%ld above=%ld\n", property->atom(otk::OBProperty::net_wm_state_below), property->atom(otk::OBProperty::net_wm_state_above));
+    printf("net_wm_state %s %ld %ld for 0x%lx\n",
+           (e.data.l[0] == 0 ? "Remove" : e.data.l[0] == 1 ? "Add" :
+            e.data.l[0] == 2 ? "Toggle" : "INVALID"),
+           e.data.l[1], e.data.l[2], _window);
 #endif
     setState((StateAction)e.data.l[0], e.data.l[1], e.data.l[2]);
   } else if (e.message_type ==
index dda528483f15630460b60474e71730a8838ac7f1..a15f369b2dfe03242c1b1620030d3756e01371e5 100644 (file)
@@ -144,12 +144,15 @@ Openbox::Openbox(int argc, char **argv)
 
   // initialize all the screens
   OBScreen *screen;
-  screen = new OBScreen(0);
-  if (screen->managed()) {
-    _screens.push_back(screen);
-    // XXX: "change to" the first workspace on the screen to initialize stuff
-  } else
-    delete screen;
+  int i = _single ? DefaultScreen(otk::OBDisplay::display) : 0;
+  int max = _single ? i + 1 : ScreenCount(otk::OBDisplay::display);
+  for (; i < max; ++i) {
+    screen = new OBScreen(i);
+    if (screen->managed())
+      _screens.push_back(screen);
+    else
+      delete screen;
+  }
 
   if (_screens.empty()) {
     printf(_("No screens were found without a window manager. Exiting.\n"));
@@ -240,6 +243,8 @@ void Openbox::parseCommandLine(int argc, char **argv)
         _scriptfilepath = argv[i];
     } else if (arg == "-sync") {
       _sync = true;
+    } else if (arg == "-single") {
+      _single = true;
     } else if (arg == "-version") {
       showVersion();
       ::exit(0);
@@ -272,9 +277,11 @@ void Openbox::showHelp()
   printf(_("Usage: %s [OPTIONS...]\n\
   Options:\n\
   -display <string>  use display connection.\n\
+  -single            run on a single screen (default is to run every one).\n\
   -rc <string>       use alternate resource file.\n\
   -menu <string>     use alternate menu file.\n\
   -script <string>   use alternate startup script file.\n\
+  -sync              run in synchronous mode (for debugging).\n\
   -version           display version and exit.\n\
   -help              display this help text and exit.\n\n"), _argv[0]);
 
index 80b20a168e70eaf59e013aa63a315849f3372983..c5dc3527e724cd0a9187ca2ca10d23e04c91865f 100644 (file)
@@ -93,6 +93,10 @@ private:
   char *_displayreq;
   //! The value of argv, i.e. how this application was executed
   char **_argv;
+  //! Run the application in synchronous mode? (for debugging)
+  bool _sync;
+  //! Should Openbox run on a single screen or on all available screens?
+  bool _single;
 
   //! A list of all managed clients
   ClientMap _clients;
@@ -121,9 +125,6 @@ private:
   //! The interface through which keys/buttons are grabbed and handled
   OBBindings *_bindings;
 
-  //! Run the application in synchronous mode? (for debugging)
-  bool _sync;
-
   //! The running state of the window manager
   RunState _state;
 
This page took 0.02906 seconds and 4 git commands to generate.