void CreateIconManagers() { IconMgr *p; int mask; char str[100]; char str1[100]; Pixel background; char *icon_name; if (Scr->NoIconManagers) return; if (Scr->siconifyPm == None) { Scr->siconifyPm = XCreatePixmapFromBitmapData(dpy, Scr->Root, (char *)siconify_bits, siconify_width, siconify_height, 1, 0, 1); } for (p = &Scr->iconmgr; p != NULL; p = p->next) { mask = XParseGeometry(p->geometry, &JunkX, &JunkY, (unsigned int *) &p->width, (unsigned int *)&p->height); if (mask & XNegative) JunkX = Scr->MyDisplayWidth - p->width - (2 * Scr->BorderWidth) + JunkX; if (mask & YNegative) JunkY = Scr->MyDisplayHeight - p->height - (2 * Scr->BorderWidth) + JunkY; background = Scr->IconManagerC.back; GetColorFromList(Scr->IconManagerBL, p->name, (XClassHint *)NULL, &background); p->w = XCreateSimpleWindow(dpy, Scr->Root, JunkX, JunkY, p->width, p->height, 1, Scr->Black, background); sprintf(str, "%s Icon Manager", p->name); sprintf(str1, "%s Icons", p->name); if (p->icon_name) icon_name = p->icon_name; else icon_name = str1; XSetStandardProperties(dpy, p->w, str, icon_name, None, NULL, 0, NULL); p->twm_win = AddWindow(p->w, TRUE, p); SetMapStateProp (p->twm_win, WithdrawnState); } for (p = &Scr->iconmgr; p != NULL; p = p->next) { GrabButtons(p->twm_win); GrabKeys(p->twm_win); } }
static void set_state_workaround(void) { FvwmWindow *t; for (t = Scr.FvwmRoot.next; t != NULL; t = t->next) { if ((t->Desk != Scr.CurrentDesk) && (!is_window_sticky_across_desks(t) && !IS_ICON_UNMAPPED(t))) { if (Scr.bo.do_enable_ewmh_iconic_state_workaround) { SetMapStateProp(t, NormalState); } else { SetMapStateProp(t, IconicState); } } } }
/*********************************************************************** * * Procedure: * HandleUnmapNotify - UnmapNotify event handler * ************************************************************************/ void HandleUnmapNotify() { int dstx, dsty; Window dumwin; XEvent dummy; extern FvwmWindow *colormap_win; int weMustUnmap; DBUG("HandleUnmapNotify","Routine Entered"); /* * Don't ignore events as described below. */ if((Event.xunmap.event != Event.xunmap.window) && (Event.xunmap.event != Scr.Root || !Event.xunmap.send_event)) { return; } /* * The July 27, 1988 ICCCM spec states that a client wishing to switch * to WithdrawnState should send a synthetic UnmapNotify with the * event field set to (pseudo-)root, in case the window is already * unmapped (which is the case for fvwm for IconicState). Unfortunately, * we looked for the FvwmContext using that field, so try the window * field also. */ weMustUnmap = 0; if (!Tmp_win) { Event.xany.window = Event.xunmap.window; weMustUnmap = 1; if (XFindContext(dpy, Event.xany.window, FvwmContext, (caddr_t *)&Tmp_win) == XCNOENT) Tmp_win = NULL; } if(!Tmp_win) return; if(weMustUnmap) XUnmapWindow(dpy, Event.xunmap.window); if(Tmp_win == Scr.Hilite) Scr.Hilite = NULL; if(Scr.PreviousFocus == Tmp_win) Scr.PreviousFocus = NULL; if((Tmp_win == Scr.Focus)&&(Tmp_win->flags & ClickToFocus)) { if(Tmp_win->next) { HandleHardFocus(Tmp_win->next); } else SetFocus(Scr.NoFocusWin,NULL,1); } if(Scr.Focus == Tmp_win) SetFocus(Scr.NoFocusWin,NULL,1); if(Tmp_win == Scr.pushed_window) Scr.pushed_window = NULL; if(Tmp_win == colormap_win) colormap_win = NULL; if ((!(Tmp_win->flags & MAPPED)&&!(Tmp_win->flags&ICONIFIED))) { return; } MyXGrabServer(dpy); if(XCheckTypedWindowEvent (dpy, Event.xunmap.window, DestroyNotify,&dummy)) { Destroy(Tmp_win); MyXUngrabServer (dpy); return; } /* * The program may have unmapped the client window, from either * NormalState or IconicState. Handle the transition to WithdrawnState. * * We need to reparent the window back to the root (so that fvwm exiting * won't cause it to get mapped) and then throw away all state (pretend * that we've received a DestroyNotify). */ if (XTranslateCoordinates (dpy, Event.xunmap.window, Scr.Root, 0, 0, &dstx, &dsty, &dumwin)) { XEvent ev; Bool reparented; reparented = XCheckTypedWindowEvent (dpy, Event.xunmap.window, ReparentNotify, &ev); SetMapStateProp (Tmp_win, WithdrawnState); if (reparented) { if (Tmp_win->old_bw) XSetWindowBorderWidth (dpy, Event.xunmap.window, Tmp_win->old_bw); if((!(Tmp_win->flags & SUPPRESSICON))&& (Tmp_win->wmhints && (Tmp_win->wmhints->flags & IconWindowHint))) XUnmapWindow (dpy, Tmp_win->wmhints->icon_window); } else { RestoreWithdrawnLocation (Tmp_win,False); } XRemoveFromSaveSet (dpy, Event.xunmap.window); XSelectInput (dpy, Event.xunmap.window, NoEventMask); Destroy(Tmp_win); /* do not need to mash event before */ /* * Flush any pending events for the window. */ /* Bzzt! it could be about to re-map */ /* while(XCheckWindowEvent(dpy, Event.xunmap.window, StructureNotifyMask | PropertyChangeMask | ColormapChangeMask | VisibilityChangeMask | EnterWindowMask | LeaveWindowMask, &dummy)); */ } /* else window no longer exists and we'll get a destroy notify */ MyXUngrabServer(dpy); XFlush (dpy); }
void HandleMapRequestKeepRaised(Window KeepRaised) { extern long isIconicState; extern Boolean PPosOverride; Boolean OnThisPage = False; Event.xany.window = Event.xmaprequest.window; if(XFindContext(dpy, Event.xany.window, FvwmContext, (caddr_t *)&Tmp_win)==XCNOENT) Tmp_win = NULL; if(!PPosOverride) XFlush(dpy); /* If the window has never been mapped before ... */ if(!Tmp_win) { /* Add decorations. */ Tmp_win = AddWindow(Event.xany.window); if (Tmp_win == NULL) return; } /* Make sure at least part of window is on this page before giving it focus... */ if ( (Tmp_win->Desk == Scr.CurrentDesk) && ( ((Tmp_win->frame_x + Tmp_win->frame_width) >= 0 && Tmp_win->frame_x < Scr.MyDisplayWidth) && ((Tmp_win->frame_y + Tmp_win->frame_height) >= 0 && Tmp_win->frame_y < Scr.MyDisplayHeight) ) ) { OnThisPage = True; } if(KeepRaised != None) XRaiseWindow(dpy,KeepRaised); /* If it's not merely iconified, and we have hints, use them. */ if (!(Tmp_win->flags & ICONIFIED)) { int state; if(Tmp_win->wmhints && (Tmp_win->wmhints->flags & StateHint)) state = Tmp_win->wmhints->initial_state; else state = NormalState; if(Tmp_win->flags & STARTICONIC) state = IconicState; if(isIconicState != DontCareState) state = isIconicState; MyXGrabServer(dpy); switch (state) { case DontCareState: case NormalState: case InactiveState: default: if (Tmp_win->Desk == Scr.CurrentDesk) { XMapWindow(dpy, Tmp_win->w); XMapWindow(dpy, Tmp_win->frame); Tmp_win->flags |= MAP_PENDING; SetMapStateProp(Tmp_win, NormalState); if((Tmp_win->flags & ClickToFocus)&& ((!Scr.Focus)||(Scr.Focus->flags & ClickToFocus))) { if (OnThisPage) { SetFocus(Tmp_win->w,Tmp_win,1); } } } else { XMapWindow(dpy, Tmp_win->w); SetMapStateProp(Tmp_win, NormalState); } break; case IconicState: if (Tmp_win->wmhints) { Iconify(Tmp_win, Tmp_win->wmhints->icon_x, Tmp_win->wmhints->icon_y); } else { Iconify(Tmp_win, 0, 0); } break; } if(!PPosOverride) XSync(dpy,0); MyXUngrabServer(dpy); } /* If no hints, or currently an icon, just "deiconify" */ else { DeIconify(Tmp_win); } if(!PPosOverride) KeepOnTop(); }