]> Dogcows Code - chaz/openbox/blobdiff - src/Screen.cc
rename fieron to not have a cap letter
[chaz/openbox] / src / Screen.cc
index 1c9c347b7e44396f9a571aef0b04b1eb8cb8fa5b..522a5be3f2db2a44eb791e1de6d93b27d134ed05 100644 (file)
@@ -407,6 +407,13 @@ void BScreen::saveAAFonts(bool f) {
 }
 
 
+void BScreen::saveShadowFonts(bool f) {
+  resource.shadow_fonts = f;
+  reconfigure();
+  config->setValue(screenstr + "dropShadowFonts", resource.shadow_fonts);
+}
+
+
 void BScreen::saveHideToolbar(bool h) {
   resource.hide_toolbar = h;
   if (resource.hide_toolbar)
@@ -589,10 +596,37 @@ void BScreen::saveRootScrollDirection(int d) {
 }
 
 
+void BScreen::saveRootMenuButton(unsigned int b) {
+  resource.root_menu_button = b;
+  const char *but;
+  switch (resource.root_menu_button) {
+  case 0: but = "None"; break;
+  case 1: but = "Left"; break;
+  case 2: but = "Middle"; break;
+  case 3: default: but = "Right"; break;
+  }
+  config->setValue(screenstr + "rootMenuButton", but);
+}
+
+
+void BScreen::saveWorkspaceMenuButton(unsigned int b) {
+  resource.workspace_menu_button = b;
+  const char *but;
+  switch (resource.workspace_menu_button) {
+  case 0: but = "None"; break;
+  case 1: but = "Left"; break;
+  case 2: default: but = "Middle"; break;
+  case 3: but = "Right"; break;
+  }
+  config->setValue(screenstr + "workspaceMenuButton", but);
+}
+
+
 void BScreen::save_rc(void) {
   saveSloppyFocus(resource.sloppy_focus);
   saveAutoRaise(resource.auto_raise);
   saveImageDither(doImageDither());
+  saveShadowFonts(resource.shadow_fonts);
   saveAAFonts(resource.aa_fonts);
   saveResizeZones(resource.resize_zones);
   saveOpaqueMove(resource.opaque_move);
@@ -621,6 +655,8 @@ void BScreen::save_rc(void) {
   saveAllowScrollLock(resource.allow_scroll_lock);
   saveWorkspaceWarping(resource.workspace_warping);
   saveRootScrollDirection(resource.root_scroll);
+  saveRootMenuButton(resource.root_menu_button);
+  saveWorkspaceMenuButton(resource.workspace_menu_button);
 
   toolbar->save_rc();
   slit->save_rc();
@@ -646,6 +682,9 @@ void BScreen::load_rc(void) {
   if (! config->getValue(screenstr + "opaqueMove", resource.opaque_move))
     resource.opaque_move = false;
 
+  if (! config->getValue(screenstr + "dropShadowFonts", resource.shadow_fonts))
+    resource.shadow_fonts = false;
+
   if (! config->getValue(screenstr + "antialiasFonts", resource.aa_fonts))
     resource.aa_fonts = true;
 
@@ -793,6 +832,29 @@ void BScreen::load_rc(void) {
     else if (s == "Reverse")
       resource.root_scroll = ReverseScroll;
   }
+
+  resource.root_menu_button = 3;
+  if (config->getValue(screenstr + "rootMenuButton", s)) {
+    if (s == "None")
+      resource.root_menu_button = 0;
+    else if (s == "Left")
+      resource.root_menu_button = 1;
+    else if (s == "Middle")
+      resource.root_menu_button = 2;
+  }
+
+  resource.workspace_menu_button = 2;
+  if (config->getValue(screenstr + "workspaceMenuButton", s)) {
+    if (s == "None")
+      resource.workspace_menu_button = 0;
+    else if (s == "Left")
+      resource.workspace_menu_button = 1;
+    else if (s == "Right")
+      resource.workspace_menu_button = 3;
+  }
+  // cant both be the same
+  if (resource.workspace_menu_button == resource.root_menu_button)
+    resource.workspace_menu_button = 0;
 }
 
 
@@ -1268,12 +1330,24 @@ void BScreen::changeWorkspaceID(unsigned int id) {
       f = win->setInputFocus();
   }
 
-  // If that fails, and we're doing focus_last, try to focus the last window.  
-  if (! f && resource.focus_last && current_workspace->getLastFocusedWindow())
-    f = current_workspace->getLastFocusedWindow()->setInputFocus();
+  // If that fails, and we're doing focus_last, try to focus the last window.
+  if (! f && resource.focus_last &&
+      (win = current_workspace->getLastFocusedWindow()))
+    f = win->setInputFocus();
+
+  /*
+    if we found a focus target, then we set the focused window explicitly
+    because it is possible to switch off this workspace before the x server
+    generates the FocusIn event for the window. if that happens, openbox would
+    lose track of what window was the 'LastFocused' window on the workspace.
 
-  // If that fails, then set focus to nothing.
-  if (! f) blackbox->setFocusedWindow((BlackboxWindow *) 0);
+    if we did not find a focus target, then set the current focused window to
+    nothing.
+  */
+  if (f)
+    blackbox->setFocusedWindow(win);
+  else
+    blackbox->setFocusedWindow((BlackboxWindow *) 0);
 
   updateNetizenCurrentWorkspace();
 }
@@ -1339,7 +1413,7 @@ void BScreen::updateStackingList(void) {
 void BScreen::addSystrayWindow(Window window) {
   XGrabServer(blackbox->getXDisplay());
   
-  XSelectInput(blackbox->getXDisplay(), window, SubstructureRedirectMask);
+  XSelectInput(blackbox->getXDisplay(), window, StructureNotifyMask);
   systrayWindowList.push_back(window);
   xatom->setValue(getRootWindow(), XAtom::kde_net_system_tray_windows,
                   XAtom::window,
@@ -2209,6 +2283,12 @@ void BScreen::shutdown(void) {
   while(! windowList.empty())
     unmanageWindow(windowList.front(), True);
 
+  while(! desktopWindowList.empty()) {
+    BlackboxWindow *win = blackbox->searchWindow(desktopWindowList.front());
+    assert(win);
+    unmanageWindow(win, True);
+  }
+
   slit->shutdown();
 }
 
@@ -2384,10 +2464,6 @@ void BScreen::buttonPressEvent(const XButtonEvent *xbutton) {
 
     if (rootmenu->isVisible())
       rootmenu->hide();
-  } else if (xbutton->button == 2) {
-    showWorkspaceMenu(xbutton->x_root, xbutton->y_root);
-  } else if (xbutton->button == 3) {
-    showRootMenu(xbutton->x_root, xbutton->y_root);
   // mouse wheel up
   } else if ((xbutton->button == 4 && resource.root_scroll == NormalScroll) ||
              (xbutton->button == 5 && resource.root_scroll == ReverseScroll)) {
@@ -2403,6 +2479,13 @@ void BScreen::buttonPressEvent(const XButtonEvent *xbutton) {
     else
       changeWorkspaceID(getCurrentWorkspaceID() - 1);
   }
+
+  if (resource.root_menu_button > 0 &&
+      xbutton->button == resource.root_menu_button)
+    showRootMenu(xbutton->x_root, xbutton->y_root);
+  else if (resource.workspace_menu_button > 0 &&
+           xbutton->button == resource.workspace_menu_button)
+    showWorkspaceMenu(xbutton->x_root, xbutton->y_root);
 }
 
 
@@ -2502,6 +2585,8 @@ BTexture BScreen::readDatabaseTexture(const string &rname,
   texture.setColor(readDatabaseColor(rname + ".color", default_color, style));
   texture.setColorTo(readDatabaseColor(rname + ".colorTo", default_color,
                                        style));
+  texture.setBorderColor(readDatabaseColor(rname + ".borderColor",
+                                           default_color, style));
   
   return texture;
 }
@@ -2541,7 +2626,7 @@ BFont *BScreen::readDatabaseFont(const string &rbasename,
     }
     
     BFont *b = new BFont(blackbox->getXDisplay(), this, family, i, bold,
-                         italic, resource.aa_fonts);
+                         italic, resource.shadow_fonts, resource.aa_fonts);
     if (b->valid())
       return b;
     else
This page took 0.026848 seconds and 4 git commands to generate.