]> Dogcows Code - chaz/openbox/blobdiff - src/openbox.cc
added ClickMouse window placement policy
[chaz/openbox] / src / openbox.cc
index c86b2124b804d967f9c13874bb2ad39552b510c7..99d623e5c99f4c3f4c556b0078a9a5540c87c356 100644 (file)
@@ -182,11 +182,11 @@ Openbox::Openbox(int m_argc, char **m_argv, char *dpy_name, char *rc)
 
   no_focus = False;
 
-  resource.menu_file = resource.style_file = (char *) 0;
-  resource.titlebar_layout = (char *) NULL;
+  resource.menu_file = resource.style_file = NULL;
+  resource.titlebar_layout = NULL;
   resource.auto_raise_delay.tv_sec = resource.auto_raise_delay.tv_usec = 0;
 
-  focused_window = masked_window = (OpenboxWindow *) 0;
+  focused_window = masked_window = NULL;
   masked = None;
 
   windowSearchList = new LinkedList<WindowSearch>;
@@ -261,6 +261,9 @@ Openbox::~Openbox() {
   if (resource.style_file)
     delete [] resource.style_file;
 
+  if (resource.titlebar_layout)
+    delete [] resource.titlebar_layout;
+
   delete timer;
 
   delete screenList;
@@ -476,9 +479,19 @@ void Openbox::process_event(XEvent *e) {
     if (! win)
       win = new OpenboxWindow(*this, e->xmaprequest.window);
 
-    if ((win = searchWindow(e->xmaprequest.window)))
+    if ((win = searchWindow(e->xmaprequest.window))) {
       win->mapRequestEvent(&e->xmaprequest);
-
+      // if we're using the click to place placement type, then immediately
+      // after the window is mapped, we need to start interactively moving it
+      if (win->getScreen()->placementPolicy() == BScreen::ClickMousePlacement) {
+        int x, y, rx, ry;
+        Window c, r;
+        unsigned int m;
+        XQueryPointer(getXDisplay(), win->getScreen()->getRootWindow(),
+                      &r, &c, &rx, &ry, &x, &y, &m);
+        win->startMove(rx, ry);
+      }
+    }
     break;
   }
 
@@ -992,7 +1005,9 @@ void Openbox::save() {
   for (BScreen *s = it.current(); s != NULL; it++, s = it.current()) {
     s->save();
     s->getToolbar()->save();
+#ifdef    SLIT
     s->getSlit()->save();
+#endif // SLIT
   }
 
   config.setAutoSave(true);
@@ -1001,7 +1016,7 @@ void Openbox::save() {
 
 void Openbox::load() {
   if (!config.load())
-    return;
+    config.create();
 
   std::string s;
   long l;
@@ -1072,7 +1087,6 @@ void Openbox::real_reconfigure() {
   grab();
 
   load();
-  save();
   
   for (int i = 0, n = menuTimestamps->count(); i < n; i++) {
     MenuTimestamp *ts = menuTimestamps->remove(0);
@@ -1138,15 +1152,16 @@ void Openbox::real_rereadMenu() {
 }
 
 
-void Openbox::saveStyleFilename(const char *filename) {
+void Openbox::setStyleFilename(const char *filename) {
   if (resource.style_file)
     delete [] resource.style_file;
 
   resource.style_file = bstrdup(filename);
+  config.setValue("session.styleFile", resource.style_file);
 }
 
 
-void Openbox::saveMenuFilename(const char *filename) {
+void Openbox::setMenuFilename(const char *filename) {
   Bool found = False;
 
   LinkedListIterator<MenuTimestamp> it(menuTimestamps);
This page took 0.022305 seconds and 4 git commands to generate.