handleUnmapnotify and gnome stuff

This commit is contained in:
fluxgen 2002-02-17 18:43:30 +00:00
parent 168fe12d69
commit f6749fb6cd

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: fluxbox.cc,v 1.33 2002/02/16 02:28:11 pekdon Exp $ // $Id: fluxbox.cc,v 1.34 2002/02/17 18:43:30 fluxgen Exp $
//Use some GNU extensions //Use some GNU extensions
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
@ -574,33 +574,7 @@ void Fluxbox::process_event(XEvent *e) {
case UnmapNotify: case UnmapNotify:
{ handleUnmapNotify(e->xunmap);
FluxboxWindow *win = 0;
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): Unmapnotify 0x"<<hex<<
e->xunmap.window<<dec<<endl;
#endif
#ifdef SLIT
Slit *slit = (Slit *) 0;
#endif // SLIT
if ((win = searchWindow(e->xunmap.window))!=0 ) {
// only process windows with StructureNotify selected
// (ignore SubstructureNotify)
// if (win->getClientWindow() != e->xunmap.window ||
// win->isTransient()) {
win->unmapNotifyEvent(&e->xunmap);
// }
#ifdef SLIT
} else if ((slit = searchSlit(e->xunmap.window))!=0) {
slit->removeClient(e->xunmap.window);
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): Here"<<endl;
#endif
#endif // SLIT
}
}
break; break;
case CreateNotify: case CreateNotify:
break; break;
@ -644,17 +618,18 @@ void Fluxbox::process_event(XEvent *e) {
} }
break; break;
case PropertyNotify: case PropertyNotify:
{ {
last_time = e->xproperty.time;
if (e->xproperty.state != PropertyDelete) {
FluxboxWindow *win = searchWindow(e->xproperty.window);
if (win)
win->propertyNotifyEvent(e->xproperty.atom);
}
last_time = e->xproperty.time;
if (e->xproperty.state != PropertyDelete) {
FluxboxWindow *win = searchWindow(e->xproperty.window);
if (win)
win->propertyNotifyEvent(e->xproperty.atom);
} }
}
break; break;
case EnterNotify: case EnterNotify:
{ {
@ -956,6 +931,40 @@ void Fluxbox::handleButtonEvent(XButtonEvent &be) {
} }
} }
void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) {
FluxboxWindow *win = 0;
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): Unmapnotify 0x"<<hex<<
ue.window<<dec<<endl;
#endif
#ifdef SLIT
Slit *slit = (Slit *) 0;
#endif // SLIT
BScreen *screen = searchScreen(ue.event);
if ( (ue.event != ue.window) && (screen != 0 || !ue.send_event))
return;
if ( (win = searchWindow(ue.window)) !=0 ) {
if (win->unmapNotifyEvent(&ue))
delete win;
}
#ifdef SLIT
else if ((slit = searchSlit(ue.window))!=0) {
slit->removeClient(ue.window);
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): Here"<<endl;
#endif
}
#endif // SLIT
}
//------------ handleClientMessage -------- //------------ handleClientMessage --------
// Handles XClientMessageEvent // Handles XClientMessageEvent
//----------------------------------------- //-----------------------------------------
@ -1320,71 +1329,50 @@ void Fluxbox::doWindowAction(Keys::KeyAction action) {
// Returns true on success else false // Returns true on success else false
//--------------------------------------------- //---------------------------------------------
bool Fluxbox::checkGnomeAtoms(XClientMessageEvent &ce) { bool Fluxbox::checkGnomeAtoms(XClientMessageEvent &ce) {
BScreen *screen = 0;
FluxboxWindow *win = 0;
win = searchWindow(ce.window);
screen = searchScreen(ce.window);
if (ce.message_type == getGnomeWorkspaceAtom()) { if (ce.message_type == getGnomeWorkspaceAtom()) {
#ifdef DEBUG #ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): Got workspace atom="<<ce.data.l[0]<<endl; cerr<<__FILE__<<"("<<__LINE__<<"): Got workspace atom="<<ce.data.l[0]<<endl;
#endif//!DEBUG #endif//!DEBUG
BScreen *screen = 0; if ( win !=0 && // the message sent to client window?
FluxboxWindow *win = 0;
if ( (win = searchWindow(ce.window))!=0 && // the message sent to client window?
win->getScreen() && ce.data.l[0] >= 0 && win->getScreen() && ce.data.l[0] >= 0 &&
ce.data.l[0] < win->getScreen()->getCount()) { ce.data.l[0] < win->getScreen()->getCount()) {
win->getScreen()->changeWorkspaceID(ce.data.l[0]); win->getScreen()->changeWorkspaceID(ce.data.l[0]);
} else if ((screen = searchScreen(ce.window))!=0 && //the message sent to root window? } else if (screen!=0 && //the message sent to root window?
ce.data.l[0] >= 0 && ce.data.l[0] >= 0 &&
ce.data.l[0] < screen->getCount()) ce.data.l[0] < screen->getCount())
screen->changeWorkspaceID(ce.data.l[0]); screen->changeWorkspaceID(ce.data.l[0]);
return true;
} else if (ce.message_type == getGnomeStateAtom()) { } else if (win) {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_STATE"<<endl; if (ce.message_type == getGnomeStateAtom()) {
#endif #ifdef DEBUG
FluxboxWindow *win = 0; cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_STATE"<<endl;
#endif
if ((win = searchWindow(ce.window))!=0) {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): Mask of members to change:"<< cerr<<__FILE__<<"("<<__LINE__<<"): Mask of members to change:"<<
hex<<ce.data.l[0]<<dec<<endl; // mask_of_members_to_change hex<<ce.data.l[0]<<dec<<endl; // mask_of_members_to_change
cerr<<"New members:"<<ce.data.l[1]<<endl; cerr<<"New members:"<<ce.data.l[1]<<endl;
if (ce.data.l[0] & BaseDisplay::WIN_STATE_STICKY) { #endif
cerr<<"Sticky"<<endl;
if (!win->isStuck()) //get new states
win->stick(); int flag = ce.data.l[0] & ce.data.l[1];
} else if (win->isStuck()) //set states
win->stick(); win->setGnomeState(flag);
if (ce.data.l[0] & BaseDisplay::WIN_STATE_MINIMIZED) { } else if (ce.message_type == getGnomeHintsAtom()) {
cerr<<"Minimized"<<endl; #ifdef DEBUG
if (!win->isIconic()) cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_HINTS"<<endl;
win->iconify(); #endif
} else if (win->isIconic()) } else
win->deiconify(true, true); return false; //the gnome atom wasn't found or not supported
} else
if (ce.data.l[0] & BaseDisplay::WIN_STATE_MAXIMIZED_VERT)
cerr<<"Maximize Vert"<<endl;
if (ce.data.l[0] & BaseDisplay::WIN_STATE_MAXIMIZED_HORIZ)
cerr<<"Maximize Horiz"<<endl;
if (ce.data.l[0] & BaseDisplay::WIN_STATE_HIDDEN)
cerr<<"Hidden"<<endl;
if (ce.data.l[0] & BaseDisplay::WIN_STATE_SHADED) {
cerr<<"Shaded"<<endl;
if (!win->isShaded()) win->shade();
}
if (ce.data.l[0] & BaseDisplay::WIN_STATE_HID_WORKSPACE)
cerr<<"HID Workspace"<<endl;
if (ce.data.l[0] & BaseDisplay::WIN_STATE_HID_TRANSIENT)
cerr<<"HID Transient"<<endl;
if (ce.data.l[0] & BaseDisplay::WIN_STATE_FIXED_POSITION)
cerr<<"Fixed Position"<<endl;
if (ce.data.l[0] & BaseDisplay::WIN_STATE_ARRANGE_IGNORE)
cerr<<"Arrange Ignore"<<endl;
}
} if (ce.message_type == getGnomeHintsAtom()) {
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): _WIN_HINTS"<<endl;
#endif
} else
return false; //no gnome atom return false; //no gnome atom
return true; return true;
@ -1413,7 +1401,7 @@ bool Fluxbox::checkNETWMAtoms(XClientMessageEvent &ce) {
Bool Fluxbox::handleSignal(int sig) { Bool Fluxbox::handleSignal(int sig) {
switch (sig) { switch (sig) {
case SIGHUP: case SIGHUP:
reconfigure(); load_rc();
break; break;
case SIGUSR1: case SIGUSR1:
@ -1429,7 +1417,6 @@ Bool Fluxbox::handleSignal(int sig) {
case SIGINT: case SIGINT:
case SIGTERM: case SIGTERM:
shutdown(); shutdown();
default: default:
return False; return False;
} }
@ -1751,7 +1738,7 @@ void Fluxbox::save_rc(void) {
BScreen *screen = it.current(); BScreen *screen = it.current();
int screen_number = screen->getScreenNumber(); int screen_number = screen->getScreenNumber();
#ifdef SLIT #ifdef SLIT
string slit_placement; string slit_placement;
switch (screen->getSlitPlacement()) { switch (screen->getSlitPlacement()) {
@ -1781,7 +1768,8 @@ void Fluxbox::save_rc(void) {
sprintf(rc_string, "session.screen%d.slit.autoHide: %s", screen_number, sprintf(rc_string, "session.screen%d.slit.autoHide: %s", screen_number,
((screen->getSlit()->doAutoHide()) ? "True" : "False")); ((screen->getSlit()->doAutoHide()) ? "True" : "False"));
XrmPutLineResource(&new_blackboxrc, rc_string); XrmPutLineResource(&new_blackboxrc, rc_string);
#endif // SLIT
#endif // SLIT
sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", screen_number, sprintf(rc_string, "session.screen%d.rowPlacementDirection: %s", screen_number,
((screen->getRowPlacementDirection() == BScreen::LEFTRIGHT) ? ((screen->getRowPlacementDirection() == BScreen::LEFTRIGHT) ?
@ -1854,15 +1842,13 @@ void Fluxbox::save_rc(void) {
// write out the users workspace names // write out the users workspace names
sprintf(rc_string, "session.screen%d.workspaceNames: ", screen_number); sprintf(rc_string, "session.screen%d.workspaceNames: ", screen_number);
string workspaces_string(rc_string); string workspaces_string(rc_string);
#ifdef DEBUG
cerr<<__FILE__<<"("<<__LINE__<<"): workspaces="<<screen->getCount()<<endl;
#endif
for (int workspace=0; workspace < screen->getCount(); workspace++) { for (int workspace=0; workspace < screen->getCount(); workspace++) {
if (screen->getWorkspace(workspace)->getName()!=0) if (screen->getWorkspace(workspace)->getName()!=0)
workspaces_string.append(screen->getWorkspace(workspace)->getName()); workspaces_string.append(screen->getWorkspace(workspace)->getName());
else else
workspaces_string.append("Null"); workspaces_string.append("Null");
workspaces_string.append(", "); workspaces_string.append(",");
} }
XrmPutLineResource(&new_blackboxrc, workspaces_string.c_str()); XrmPutLineResource(&new_blackboxrc, workspaces_string.c_str());
@ -2338,15 +2324,6 @@ void Fluxbox::real_rereadMenu(void) {
it.current()->rereadMenu(); it.current()->rereadMenu();
} }
/*
void Fluxbox::saveStyleFilename(const char *filename) {
if (resource.style_file)
delete [] resource.style_file;
resource.style_file = StringUtil::strdup(filename);
}
*/
void Fluxbox::saveMenuFilename(const char *filename) { void Fluxbox::saveMenuFilename(const char *filename) {
Bool found = False; Bool found = False;