aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-02-17 18:43:30 (GMT)
committerfluxgen <fluxgen>2002-02-17 18:43:30 (GMT)
commitf6749fb6cd6519eb8800c046db0dfdebeac84404 (patch)
treea086d54d9948a940ebfa09caf38a3539a485618b /src
parent168fe12d696bbff6baa95624ef09199eff7e1d95 (diff)
downloadfluxbox-f6749fb6cd6519eb8800c046db0dfdebeac84404.zip
fluxbox-f6749fb6cd6519eb8800c046db0dfdebeac84404.tar.bz2
handleUnmapnotify and gnome stuff
Diffstat (limited to 'src')
-rw-r--r--src/fluxbox.cc183
1 files changed, 80 insertions, 103 deletions
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 1b332b6..2ad0e6f 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.33 2002/02/16 02:28:11 pekdon Exp $ 25// $Id: fluxbox.cc,v 1.34 2002/02/17 18:43:30 fluxgen Exp $
26 26
27//Use some GNU extensions 27//Use some GNU extensions
28#ifndef _GNU_SOURCE 28#ifndef _GNU_SOURCE
@@ -574,33 +574,7 @@ void Fluxbox::process_event(XEvent *e) {
574 574
575 575
576 case UnmapNotify: 576 case UnmapNotify:
577 { 577 handleUnmapNotify(e->xunmap);
578
579 FluxboxWindow *win = 0;
580 #ifdef DEBUG
581 cerr<<__FILE__<<"("<<__LINE__<<"): Unmapnotify 0x"<<hex<<
582 e->xunmap.window<<dec<<endl;
583 #endif
584 #ifdef SLIT
585 Slit *slit = (Slit *) 0;
586 #endif // SLIT
587
588 if ((win = searchWindow(e->xunmap.window))!=0 ) {
589 // only process windows with StructureNotify selected
590 // (ignore SubstructureNotify)
591// if (win->getClientWindow() != e->xunmap.window ||
592// win->isTransient()) {
593 win->unmapNotifyEvent(&e->xunmap);
594// }
595 #ifdef SLIT
596 } else if ((slit = searchSlit(e->xunmap.window))!=0) {
597 slit->removeClient(e->xunmap.window);
598 #ifdef DEBUG
599 cerr<<__FILE__<<"("<<__LINE__<<"): Here"<<endl;
600 #endif
601 #endif // SLIT
602 }
603 }
604 break; 578 break;
605 case CreateNotify: 579 case CreateNotify:
606 break; 580 break;
@@ -644,17 +618,18 @@ void Fluxbox::process_event(XEvent *e) {
644 } 618 }
645 break; 619 break;
646 case PropertyNotify: 620 case PropertyNotify:
647 { 621 {
648 last_time = e->xproperty.time; 622
623 last_time = e->xproperty.time;
649 624
650 if (e->xproperty.state != PropertyDelete) { 625 if (e->xproperty.state != PropertyDelete) {
651 FluxboxWindow *win = searchWindow(e->xproperty.window); 626 FluxboxWindow *win = searchWindow(e->xproperty.window);
652 627
653 if (win) 628 if (win)
654 win->propertyNotifyEvent(e->xproperty.atom); 629 win->propertyNotifyEvent(e->xproperty.atom);
655 }
656
657 } 630 }
631
632 }
658 break; 633 break;
659 case EnterNotify: 634 case EnterNotify:
660 { 635 {
@@ -956,6 +931,40 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
956 } 931 }
957} 932}
958 933
934void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) {
935
936
937 FluxboxWindow *win = 0;
938 #ifdef DEBUG
939 cerr<<__FILE__<<"("<<__LINE__<<"): Unmapnotify 0x"<<hex<<
940 ue.window<<dec<<endl;
941 #endif
942
943 #ifdef SLIT
944 Slit *slit = (Slit *) 0;
945 #endif // SLIT
946 BScreen *screen = searchScreen(ue.event);
947
948 if ( (ue.event != ue.window) && (screen != 0 || !ue.send_event))
949 return;
950
951 if ( (win = searchWindow(ue.window)) !=0 ) {
952
953 if (win->unmapNotifyEvent(&ue))
954 delete win;
955
956 }
957 #ifdef SLIT
958 else if ((slit = searchSlit(ue.window))!=0) {
959 slit->removeClient(ue.window);
960 #ifdef DEBUG
961 cerr<<__FILE__<<"("<<__LINE__<<"): Here"<<endl;
962 #endif
963 }
964 #endif // SLIT
965
966}
967
959//------------ handleClientMessage -------- 968//------------ handleClientMessage --------
960// Handles XClientMessageEvent 969// Handles XClientMessageEvent
961//----------------------------------------- 970//-----------------------------------------
@@ -1320,71 +1329,50 @@ void Fluxbox::doWindowAction(Keys::KeyAction action) {
1320// Returns true on success else false 1329// Returns true on success else false
1321//--------------------------------------------- 1330//---------------------------------------------
1322bool Fluxbox::checkGnomeAtoms(XClientMessageEvent &ce) { 1331bool Fluxbox::checkGnomeAtoms(XClientMessageEvent &ce) {
1332 BScreen *screen = 0;
1333 FluxboxWindow *win = 0;
1334 win = searchWindow(ce.window);
1335 screen = searchScreen(ce.window);
1336
1323 if (ce.message_type == getGnomeWorkspaceAtom()) { 1337 if (ce.message_type == getGnomeWorkspaceAtom()) {
1324 #ifdef DEBUG 1338 #ifdef DEBUG
1325 cerr<<__FILE__<<"("<<__LINE__<<"): Got workspace atom="<<ce.data.l[0]<<endl; 1339 cerr<<__FILE__<<"("<<__LINE__<<"): Got workspace atom="<<ce.data.l[0]<<endl;
1326 #endif//!DEBUG 1340 #endif//!DEBUG
1327 BScreen *screen = 0; 1341 if ( win !=0 && // the message sent to client window?
1328 FluxboxWindow *win = 0;
1329
1330 if ( (win = searchWindow(ce.window))!=0 && // the message sent to client window?
1331 win->getScreen() && ce.data.l[0] >= 0 && 1342 win->getScreen() && ce.data.l[0] >= 0 &&
1332 ce.data.l[0] < win->getScreen()->getCount()) { 1343 ce.data.l[0] < win->getScreen()->getCount()) {
1333 win->getScreen()->changeWorkspaceID(ce.data.l[0]); 1344 win->getScreen()->changeWorkspaceID(ce.data.l[0]);
1334 1345
1335 } else if ((screen = searchScreen(ce.window))!=0 && //the message sent to root window? 1346 } else if (screen!=0 && //the message sent to root window?
1336 ce.data.l[0] >= 0 && 1347 ce.data.l[0] >= 0 &&
1337 ce.data.l[0] < screen->getCount()) 1348 ce.data.l[0] < screen->getCount())
1338 screen->changeWorkspaceID(ce.data.l[0]); 1349 screen->changeWorkspaceID(ce.data.l[0]);
1339 1350 return true;
1340 } else if (ce.message_type == getGnomeStateAtom()) { 1351 } else if (win) {
1341 #ifdef DEBUG 1352
1342 cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_STATE"<<endl; 1353 if (ce.message_type == getGnomeStateAtom()) {
1343 #endif 1354 #ifdef DEBUG
1344 FluxboxWindow *win = 0; 1355 cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_STATE"<<endl;
1345 1356 #endif
1346 if ((win = searchWindow(ce.window))!=0) { 1357
1358 #ifdef DEBUG
1347 cerr<<__FILE__<<"("<<__LINE__<<"): Mask of members to change:"<< 1359 cerr<<__FILE__<<"("<<__LINE__<<"): Mask of members to change:"<<
1348 hex<<ce.data.l[0]<<dec<<endl; // mask_of_members_to_change 1360 hex<<ce.data.l[0]<<dec<<endl; // mask_of_members_to_change
1349 cerr<<"New members:"<<ce.data.l[1]<<endl; 1361 cerr<<"New members:"<<ce.data.l[1]<<endl;
1350 if (ce.data.l[0] & BaseDisplay::WIN_STATE_STICKY) { 1362 #endif
1351 cerr<<"Sticky"<<endl; 1363
1352 if (!win->isStuck()) 1364 //get new states
1353 win->stick(); 1365 int flag = ce.data.l[0] & ce.data.l[1];
1354 } else if (win->isStuck()) 1366 //set states
1355 win->stick(); 1367 win->setGnomeState(flag);
1356
1357 if (ce.data.l[0] & BaseDisplay::WIN_STATE_MINIMIZED) {
1358 cerr<<"Minimized"<<endl;
1359 if (!win->isIconic())
1360 win->iconify();
1361 } else if (win->isIconic())
1362 win->deiconify(true, true);
1363 1368
1364 if (ce.data.l[0] & BaseDisplay::WIN_STATE_MAXIMIZED_VERT) 1369 } else if (ce.message_type == getGnomeHintsAtom()) {
1365 cerr<<"Maximize Vert"<<endl; 1370 #ifdef DEBUG
1366 if (ce.data.l[0] & BaseDisplay::WIN_STATE_MAXIMIZED_HORIZ) 1371 cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_HINTS"<<endl;
1367 cerr<<"Maximize Horiz"<<endl; 1372 #endif
1368 if (ce.data.l[0] & BaseDisplay::WIN_STATE_HIDDEN) 1373 } else
1369 cerr<<"Hidden"<<endl; 1374 return false; //the gnome atom wasn't found or not supported
1370 if (ce.data.l[0] & BaseDisplay::WIN_STATE_SHADED) { 1375 } else
1371 cerr<<"Shaded"<<endl;
1372 if (!win->isShaded()) win->shade();
1373 }
1374 if (ce.data.l[0] & BaseDisplay::WIN_STATE_HID_WORKSPACE)
1375 cerr<<"HID Workspace"<<endl;
1376 if (ce.data.l[0] & BaseDisplay::WIN_STATE_HID_TRANSIENT)
1377 cerr<<"HID Transient"<<endl;
1378 if (ce.data.l[0] & BaseDisplay::WIN_STATE_FIXED_POSITION)
1379 cerr<<"Fixed Position"<<endl;
1380 if (ce.data.l[0] & BaseDisplay::WIN_STATE_ARRANGE_IGNORE)
1381 cerr<<"Arrange Ignore"<<endl;
1382 }
1383 } if (ce.message_type == getGnomeHintsAtom()) {
1384 #ifdef DEBUG
1385 cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_HINTS"<<endl;
1386 #endif
1387 } else
1388 return false; //no gnome atom 1376 return false; //no gnome atom
1389 1377
1390 return true; 1378 return true;
@@ -1413,7 +1401,7 @@ bool Fluxbox::checkNETWMAtoms(XClientMessageEvent &ce) {
1413Bool Fluxbox::handleSignal(int sig) { 1401Bool Fluxbox::handleSignal(int sig) {
1414 switch (sig) { 1402 switch (sig) {
1415 case SIGHUP: 1403 case SIGHUP:
1416 reconfigure(); 1404 load_rc();
1417 break; 1405 break;
1418 1406
1419 case SIGUSR1: 1407 case SIGUSR1:
@@ -1429,7 +1417,6 @@ Bool Fluxbox::handleSignal(int sig) {
1429 case SIGINT: 1417 case SIGINT:
1430 case SIGTERM: 1418 case SIGTERM:
1431 shutdown(); 1419 shutdown();
1432
1433 default: 1420 default:
1434 return False; 1421 return False;
1435 } 1422 }
@@ -1751,7 +1738,7 @@ void Fluxbox::save_rc(void) {
1751 BScreen *screen = it.current(); 1738 BScreen *screen = it.current();
1752 int screen_number = screen->getScreenNumber(); 1739 int screen_number = screen->getScreenNumber();
1753 1740
1754#ifdef SLIT 1741 #ifdef SLIT
1755 string slit_placement; 1742 string slit_placement;
1756 1743
1757 switch (screen->getSlitPlacement()) { 1744 switch (screen->getSlitPlacement()) {
@@ -1781,7 +1768,8 @@ void Fluxbox::save_rc(void) {
1781 sprintf(rc_string, "session.screen%d.slit.autoHide: %s", screen_number, 1768 sprintf(rc_string, "session.screen%d.slit.autoHide: %s", screen_number,
1782 ((screen->getSlit()->doAutoHide()) ? "True" : "False")); 1769 ((screen->getSlit()->doAutoHide()) ? "True" : "False"));
1783 XrmPutLineResource(&new_blackboxrc, rc_string); 1770 XrmPutLineResource(&new_blackboxrc, rc_string);
1784#endif // SLIT 1771
1772 #endif // SLIT
1785 1773
1786 sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", screen_number, 1774 sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", screen_number,
1787 ((screen->getRowPlacementDirection() == BScreen::LEFTRIGHT) ? 1775 ((screen->getRowPlacementDirection() == BScreen::LEFTRIGHT) ?
@@ -1854,15 +1842,13 @@ void Fluxbox::save_rc(void) {
1854 // write out the users workspace names 1842 // write out the users workspace names
1855 sprintf(rc_string, "session.screen%d.workspaceNames: ", screen_number); 1843 sprintf(rc_string, "session.screen%d.workspaceNames: ", screen_number);
1856 string workspaces_string(rc_string); 1844 string workspaces_string(rc_string);
1857 #ifdef DEBUG 1845
1858 cerr<<__FILE__<<"("<<__LINE__<<"): workspaces="<<screen->getCount()<<endl;
1859 #endif
1860 for (int workspace=0; workspace < screen->getCount(); workspace++) { 1846 for (int workspace=0; workspace < screen->getCount(); workspace++) {
1861 if (screen->getWorkspace(workspace)->getName()!=0) 1847 if (screen->getWorkspace(workspace)->getName()!=0)
1862 workspaces_string.append(screen->getWorkspace(workspace)->getName()); 1848 workspaces_string.append(screen->getWorkspace(workspace)->getName());
1863 else 1849 else
1864 workspaces_string.append("Null"); 1850 workspaces_string.append("Null");
1865 workspaces_string.append(", "); 1851 workspaces_string.append(",");
1866 } 1852 }
1867 1853
1868 XrmPutLineResource(&new_blackboxrc, workspaces_string.c_str()); 1854 XrmPutLineResource(&new_blackboxrc, workspaces_string.c_str());
@@ -2338,15 +2324,6 @@ void Fluxbox::real_rereadMenu(void) {
2338 it.current()->rereadMenu(); 2324 it.current()->rereadMenu();
2339} 2325}
2340 2326
2341/*
2342void Fluxbox::saveStyleFilename(const char *filename) {
2343 if (resource.style_file)
2344 delete [] resource.style_file;
2345
2346 resource.style_file = StringUtil::strdup(filename);
2347}
2348*/
2349
2350void Fluxbox::saveMenuFilename(const char *filename) { 2327void Fluxbox::saveMenuFilename(const char *filename) {
2351 Bool found = False; 2328 Bool found = False;
2352 2329