void paint_app_icon(WApplication *wapp) { WIcon *icon; virtual_screen *vscr; WDock *attracting_dock; int x = 0, y = 0; Bool update_icon = False; if (!wapp || !wapp->app_icon || !wapp->main_window_desc) return; icon = wapp->app_icon->icon; vscr = wapp->main_window_desc->vscr; wapp->app_icon->main_window = wapp->main_window; /* If the icon is docked, don't continue */ if (wapp->app_icon->docked) return; attracting_dock = vscr->drawer.attracting_drawer != NULL ? vscr->drawer.attracting_drawer : vscr->workspace.array[vscr->workspace.current]->clip; if (attracting_dock && attracting_dock->attract_icons && wDockFindFreeSlot(attracting_dock, &x, &y)) { wapp->app_icon->attracted = 1; if (!icon->shadowed) { icon->shadowed = 1; update_icon = True; } wDockAttachIcon(attracting_dock, wapp->app_icon, x, y, update_icon); } else { /* We must know if the icon is painted in the screen, * because if painted, then PlaceIcon will return the next * space on the screen, and the icon will move */ if (wapp->app_icon->next == NULL && wapp->app_icon->prev == NULL) { PlaceIcon(vscr, &x, &y, wGetHeadForWindow(wapp->main_window_desc)); wAppIconMove(wapp->app_icon, x, y); wLowerFrame(icon->vscr, icon->core); } } /* If we want appicon (no_appicon is not set) and the icon is not * in the appicon_list, we must add it. Else, we want to avoid * having it on the list */ if (!WFLAGP(wapp->main_window_desc, no_appicon) && wapp->app_icon->next == NULL && wapp->app_icon->prev == NULL) add_to_appicon_list(wapp->app_icon); if (!attracting_dock || !wapp->app_icon->attracted || !attracting_dock->collapsed) XMapWindow(dpy, icon->core->window); if (wPreferences.auto_arrange_icons && !wapp->app_icon->attracted) wArrangeIcons(vscr, True); }
void move_appicon_to_dock(virtual_screen *vscr, WAppIcon *icon, char *wm_class, char *wm_instance) { WAppIcon *aicon; int x0, y0; /* Create appicon's icon */ aicon = create_appicon(vscr, NULL, wm_class, wm_instance); aicon->icon->core->descriptor.parent_type = WCLASS_APPICON; aicon->icon->core->descriptor.parent = aicon; appicon_map(aicon); /* Map it on the screen, in the right possition */ PlaceIcon(vscr, &x0, &y0, wGetHeadForWindow(aicon->icon->owner)); wAppIconMove(aicon, x0, y0); XMapWindow(dpy, aicon->icon->core->window); aicon->launching = 1; wAppIconPaint(aicon); /* Move to the docked icon and destroy it */ slide_window(aicon->icon->core->window, x0, y0, icon->x_pos, icon->y_pos); XUnmapWindow(dpy, aicon->icon->core->window); wAppIconDestroy(aicon); }
static void execMenuCommand(WMenu * menu, WMenuEntry * entry) { WWindow *wwin = (WWindow *) entry->clientdata; WApplication *wapp; CloseWindowMenu(menu->frame->screen_ptr); switch (entry->order) { case MC_CLOSE: /* send delete message */ wClientSendProtocol(wwin, w_global.atom.wm.delete_window, w_global.timestamp.last_event); break; case MC_KILL: wretain(wwin); if (wPreferences.dont_confirm_kill || wMessageDialog(menu->frame->screen_ptr, _("Kill Application"), _ ("This will kill the application.\nAny unsaved changes will be lost.\nPlease confirm."), _("Yes"), _("No"), NULL) == WAPRDefault) { if (!wwin->flags.destroyed) wClientKill(wwin); } wrelease(wwin); break; case MC_MINIATURIZE: if (wwin->flags.miniaturized) { wDeiconifyWindow(wwin); } else { if (wwin->protocols.MINIATURIZE_WINDOW) { wClientSendProtocol(wwin, w_global.atom.gnustep.wm_miniaturize_window, w_global.timestamp.last_event); } else { wIconifyWindow(wwin); } } break; case MC_MAXIMIZE: if (wwin->flags.maximized) wUnmaximizeWindow(wwin); else wMaximizeWindow(wwin, MAX_VERTICAL | MAX_HORIZONTAL, wGetHeadForWindow(wwin)); break; case MC_SHADE: if (wwin->flags.shaded) wUnshadeWindow(wwin); else wShadeWindow(wwin); break; case MC_SELECT: if (!wwin->flags.miniaturized) wSelectWindow(wwin, !wwin->flags.selected); else wIconSelect(wwin->icon); break; case MC_MOVERESIZE: wKeyboardMoveResizeWindow(wwin); break; case MC_PROPERTIES: wShowInspectorForWindow(wwin); break; case MC_RELAUNCH: (void) RelaunchWindow(wwin); break; case MC_HIDE: wapp = wApplicationOf(wwin->main_window); wHideApplication(wapp); break; } }