]> Dogcows Code - chaz/openbox/commitdiff
add a xinerama support menu
authorDana Jansens <danakj@orodu.net>
Mon, 22 Jul 2002 08:09:34 +0000 (08:09 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 22 Jul 2002 08:09:34 +0000 (08:09 +0000)
src/Configmenu.cc
src/Configmenu.hh
src/Screen.cc

index c5c58d916cab03aa98476c4ff1f6f9af94274de3..1c18387c84fea0e950ac4ed40e380829d298a206 100644 (file)
@@ -38,11 +38,18 @@ Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) {
 
   focusmenu = new Focusmenu(this);
   placementmenu = new Placementmenu(this);
+#ifdef    XINERAMA
+  xineramamenu = new Xineramamenu(this);
+#endif // XINERAMA
 
   insert(i18n(ConfigmenuSet, ConfigmenuFocusModel,
               "Focus Model"), focusmenu);
   insert(i18n(ConfigmenuSet, ConfigmenuWindowPlacement,
               "Window Placement"), placementmenu);
+#ifdef    XINERAMA
+  insert(i18n(ConfigmenuSet, ConfigmenuXineramaSupport,
+              "XineramaSupport"), xineramamenu);
+#endif // XINERAMA
   insert(i18n(ConfigmenuSet, ConfigmenuImageDithering,
               "Image Dithering"), 1);
   insert(i18n(ConfigmenuSet, ConfigmenuOpaqueMove,
@@ -67,24 +74,27 @@ Configmenu::Configmenu(BScreen *scr) : Basemenu(scr) {
 
 
 void Configmenu::setValues(void) {
-  setItemSelected(2, getScreen()->doImageDither());
-  setItemSelected(3, getScreen()->doOpaqueMove());
-  setItemSelected(4, getScreen()->doFullMax());
-  setItemSelected(5, getScreen()->doFocusNew());
-  setItemSelected(6, getScreen()->doFocusLast());
-  setItemSelected(7, getScreen()->getWindowToWindowSnap());
-
-  setItemSelected(8, getScreen()->getWindowCornerSnap());
-  setItemEnabled(8, getScreen()->getWindowToWindowSnap());
+  setItemSelected(3, getScreen()->doImageDither());
+  setItemSelected(4, getScreen()->doOpaqueMove());
+  setItemSelected(5, getScreen()->doFullMax());
+  setItemSelected(6, getScreen()->doFocusNew());
+  setItemSelected(7, getScreen()->doFocusLast());
+  setItemSelected(8, getScreen()->getWindowToWindowSnap());
+
+  setItemSelected(9, getScreen()->getWindowCornerSnap());
+  setItemEnabled(9, getScreen()->getWindowToWindowSnap());
   
-  setItemSelected(9, getScreen()->allowScrollLock());
-  setItemSelected(10, getScreen()->doHideToolbar());
+  setItemSelected(10, getScreen()->allowScrollLock());
+  setItemSelected(11, getScreen()->doHideToolbar());
 }
 
 
 Configmenu::~Configmenu(void) {
   delete focusmenu;
   delete placementmenu;
+#ifdef    XINERAMA
+  delete xineramamenu;
+#endif // XINERAMA
 }
 
 
@@ -152,6 +162,7 @@ void Configmenu::reconfigure(void) {
   setValues();
   focusmenu->reconfigure();
   placementmenu->reconfigure();
+  xineramamenu->reconfigure();
 
   Basemenu::reconfigure();
 }
@@ -418,3 +429,65 @@ void Configmenu::Placementmenu::itemSelected(int button, unsigned int index) {
     break;
   }
 }
+
+
+#ifdef    XINERAMA
+Configmenu::Xineramamenu::Xineramamenu(Configmenu *cm):
+  Basemenu(cm->getScreen()) {
+  setLabel(i18n(ConfigmenuSet, ConfigmenuXineramaSupport, "Xinerama Support"));
+  setInternalMenu();
+
+  insert(i18n(ConfigmenuSet, ConfigmenuXineramaPlacement, "Window Placement"),
+         1);
+  insert(i18n(ConfigmenuSet, ConfigmenuXineramaMaximizing, "Window Maximizing"),
+         2);
+  insert(i18n(ConfigmenuSet, ConfigmenuXineramaSnapping, "Window Snapping"),
+         3);
+
+  update();
+  setValues();
+}
+
+
+void Configmenu::Xineramamenu::setValues(void) {
+  setItemSelected(0, getScreen()->getBlackbox()->doXineramaPlacement());
+  setItemSelected(1, getScreen()->getBlackbox()->doXineramaMaximizing());
+  setItemSelected(2, getScreen()->getBlackbox()->doXineramaSnapping());
+}
+
+
+void Configmenu::Xineramamenu::reconfigure(void) {
+  setValues();
+  Basemenu::reconfigure();
+}
+
+
+void Configmenu::Xineramamenu::itemSelected(int button, unsigned int index) {
+  if (button != 1)
+    return;
+
+  BasemenuItem *item = find(index);
+
+  if (! item->function())
+    return;
+
+  Blackbox *bb = getScreen()->getBlackbox();
+
+  switch (item->function()) {
+  case 1: // window placement
+    bb->saveXineramaPlacement(! bb->doXineramaPlacement());
+    setItemSelected(0, bb->doXineramaPlacement());
+    break;
+
+  case 2: // window maximizing
+    bb->saveXineramaMaximizing(! bb->doXineramaMaximizing());
+    setItemSelected(1, bb->doXineramaMaximizing());
+    break;
+
+  case 3: // window snapping
+    bb->saveXineramaSnapping(! bb->doXineramaSnapping());
+    setItemSelected(2, bb->doXineramaSnapping());
+    break;
+  }
+}
+#endif // XINERAMA
index c3631faea6b5416c9e17a4cb5b41ac959afb564e..3ff3222de11992ed96e8a4f96f609796073c6b02 100644 (file)
@@ -61,8 +61,27 @@ private:
     virtual void reconfigure(void);
   };
 
+#ifdef    XINERAMA
+  class Xineramamenu : public Basemenu {
+  private:
+    Xineramamenu(const Xineramamenu&);
+    Xineramamenu& operator=(const Xineramamenu&);
+
+  protected:
+    virtual void itemSelected(int button, unsigned int index);
+    virtual void setValues(void);
+
+  public:
+    Xineramamenu(Configmenu *cm);
+    virtual void reconfigure(void);
+  };
+#endif // XINERAMA
+
   Focusmenu *focusmenu;
   Placementmenu *placementmenu;
+#ifdef    XINERAMA
+  Xineramamenu *xineramamenu;
+#endif // XINERAMA
 
   friend class Focusmenu;
   friend class Placementmenu;
@@ -80,6 +99,9 @@ public:
 
   inline Basemenu *getFocusmenu(void) { return focusmenu; }
   inline Basemenu *getPlacementmenu(void) { return placementmenu; }
+#ifdef    XINERAMA
+  inline Basemenu *getXineramamenu(void) { return xineramamenu; }
+#endif // XINERAMA
 
   virtual void reconfigure(void);
 };
index ef7fb6a50a728af3951653f6d671d8c8815a5083..378d61e1d0b14fbb8704015e102f1176f25174a7 100644 (file)
@@ -1399,8 +1399,13 @@ void BScreen::updateNetizenConfigNotify(XEvent *e) {
 
 void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) {
   // the 13 represents the number of blackbox windows such as menus
+  int bbwins = 13;
+#ifdef    XINERAMA
+  ++bbwins;
+#endif // XINERAMA
+
   Window *session_stack = new
-    Window[(num + workspacesList.size() + rootmenuList.size() + 13)];
+    Window[(num + workspacesList.size() + rootmenuList.size() + bbwins)];
   unsigned int i = 0, k = num;
 
   XRaiseWindow(blackbox->getXDisplay(), iconmenu->getWindowID());
@@ -1415,6 +1420,9 @@ void BScreen::raiseWindows(Window *workspace_stack, unsigned int num) {
 
   *(session_stack + i++) = configmenu->getFocusmenu()->getWindowID();
   *(session_stack + i++) = configmenu->getPlacementmenu()->getWindowID();
+#ifdef    XINERAMA
+  *(session_stack + i++) = configmenu->getXineramamenu()->getWindowID();
+#endif // XINERAMA
   *(session_stack + i++) = configmenu->getWindowID();
 
   *(session_stack + i++) = slit->getMenu()->getDirectionmenu()->getWindowID();
This page took 0.031203 seconds and 4 git commands to generate.