void create_appicon_for_application(WApplication *wapp, WWindow *wwin) { /* Try to create an icon from the dock or clip */ create_appicon_from_dock(wwin, wapp); if (wapp->app_icon) return; /* Create the icon */ wAppIcon_create(wapp); wAppIcon_map(wapp->app_icon); wIconUpdate(wapp->app_icon->icon); /* Now, paint the icon */ if (!WFLAGP(wapp->main_window_desc, no_appicon)) paint_app_icon(wapp); /* * At this point the application is fully set up and all icon and * window data are known - so try to save the icon file for docked * applications to ensure that the file exists when window maker * starts up next time. */ if (wapp->app_icon->docked && !WFLAGP(wapp->main_window_desc, no_appicon)) save_appicon(wapp->app_icon); }
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); }
static void create_appicon_from_dock(WWindow *wwin, WApplication *wapp) { virtual_screen *vscr = wwin->vscr; Window main_window = wapp->main_window; wapp->app_icon = NULL; if (vscr->last_dock) wapp->app_icon = findDockIconFor(vscr->last_dock, main_window); /* check main dock if we did not find it in last dock */ if (!wapp->app_icon && vscr->dock.dock) wapp->app_icon = findDockIconFor(vscr->dock.dock, main_window); /* check clips */ if (!wapp->app_icon) { int i; for (i = 0; i < vscr->workspace.count; i++) { WDock *dock = vscr->workspace.array[i]->clip; if (dock) wapp->app_icon = findDockIconFor(dock, main_window); if (wapp->app_icon) break; } } /* Finally check drawers */ if (!wapp->app_icon) { WDrawerChain *dc; for (dc = vscr->drawer.drawers; dc != NULL; dc = dc->next) { wapp->app_icon = findDockIconFor(dc->adrawer, main_window); if (wapp->app_icon) break; } } /* If created, then set some flags */ if (wapp->app_icon && !WFLAGP(wapp->main_window_desc, no_appicon)) { WWindow *mainw = wapp->main_window_desc; wapp->app_icon->running = 1; wapp->app_icon->icon->owner = mainw; if (mainw->wm_hints && (mainw->wm_hints->flags & IconWindowHint)) wapp->app_icon->icon->icon_win = mainw->wm_hints->icon_window; /* Update the icon images */ wIconUpdate(wapp->app_icon->icon); /* Paint it */ wAppIconPaint(wapp->app_icon); } }
static void updateMenuForWindow(WMenu * menu, WWindow * wwin) { WApplication *wapp = wApplicationOf(wwin->main_window); WScreen *scr = wwin->screen_ptr; int i; updateOptionsMenu(menu, wwin); updateMaximizeMenu(menu, wwin); updateMakeShortcutMenu(menu, wwin); wMenuSetEnabled(menu, MC_HIDE, wapp != NULL && !WFLAGP(wapp->main_window_desc, no_appicon)); wMenuSetEnabled(menu, MC_CLOSE, (wwin->protocols.DELETE_WINDOW && !WFLAGP(wwin, no_closable))); if (wwin->flags.miniaturized) { static char *text = NULL; if (!text) text = _("Deminiaturize"); menu->entries[MC_MINIATURIZE]->text = text; } else { static char *text = NULL; if (!text) text = _("Miniaturize"); menu->entries[MC_MINIATURIZE]->text = text; } wMenuSetEnabled(menu, MC_MINIATURIZE, !WFLAGP(wwin, no_miniaturizable)); if (wwin->flags.maximized) { static char *text = NULL; if (!text) text = _("Unmaximize"); menu->entries[MC_MAXIMIZE]->text = text; updateUnmaximizeShortcut(menu->entries[MC_MAXIMIZE], wwin->flags.maximized); } else { static char *text = NULL; if (!text) text = _("Maximize"); menu->entries[MC_MAXIMIZE]->text = text; menu->entries[MC_MAXIMIZE]->rtext = GetShortcutKey(wKeyBindings[WKBD_MAXIMIZE]); } wMenuSetEnabled(menu, MC_MAXIMIZE, IS_RESIZABLE(wwin)); wMenuSetEnabled(menu, MC_MOVERESIZE, IS_RESIZABLE(wwin) && !wwin->flags.miniaturized); if (wwin->flags.shaded) { static char *text = NULL; if (!text) text = _("Unshade"); menu->entries[MC_SHADE]->text = text; } else { static char *text = NULL; if (!text) text = _("Shade"); menu->entries[MC_SHADE]->text = text; } wMenuSetEnabled(menu, MC_SHADE, !WFLAGP(wwin, no_shadeable) && !wwin->flags.miniaturized); if (wwin->flags.selected) { static char *text = NULL; if (!text) text = _("Deselect"); menu->entries[MC_SELECT]->text = text; } else { static char *text = NULL; if (!text) text = _("Select"); menu->entries[MC_SELECT]->text = text; } wMenuSetEnabled(menu, MC_CHANGEWKSPC, !IS_OMNIPRESENT(wwin)); if (!wwin->flags.inspector_open) { wMenuSetEnabled(menu, MC_PROPERTIES, True); } else { wMenuSetEnabled(menu, MC_PROPERTIES, False); } /* Update shortcut labels except for (Un)Maximize which is * handled separately. */ menu->entries[MC_MINIATURIZE]->rtext = GetShortcutKey(wKeyBindings[WKBD_MINIATURIZE]); menu->entries[MC_SHADE]->rtext = GetShortcutKey(wKeyBindings[WKBD_SHADE]); menu->entries[MC_HIDE]->rtext = GetShortcutKey(wKeyBindings[WKBD_HIDE]); menu->entries[MC_MOVERESIZE]->rtext = GetShortcutKey(wKeyBindings[WKBD_MOVERESIZE]); menu->entries[MC_SELECT]->rtext = GetShortcutKey(wKeyBindings[WKBD_SELECT]); menu->entries[MC_RELAUNCH]->rtext = GetShortcutKey(wKeyBindings[WKBD_RELAUNCH]); menu->entries[MC_CLOSE]->rtext = GetShortcutKey(wKeyBindings[WKBD_CLOSE]); /* set the client data of the entries to the window */ for (i = 0; i < menu->entry_no; i++) { menu->entries[i]->clientdata = wwin; } for (i = 0; i < scr->workspace_submenu->entry_no; i++) { scr->workspace_submenu->entries[i]->clientdata = wwin; if (i == scr->current_workspace) wMenuSetEnabled(scr->workspace_submenu, i, False); else wMenuSetEnabled(scr->workspace_submenu, i, True); } menu->flags.realized = 0; wMenuRealize(menu); }
WApplication *wApplicationCreate(WWindow * wwin) { WScreen *scr = wwin->screen_ptr; Window main_window = wwin->main_window; WApplication *wapp; WWindow *leader; if (main_window == None || main_window == scr->root_win) return NULL; { Window root; int foo; unsigned int bar; /* check if the window is valid */ if (!XGetGeometry(dpy, main_window, &root, &foo, &foo, &bar, &bar, &bar, &bar)) return NULL; } wapp = wApplicationOf(main_window); if (wapp) { wapp->refcount++; if (wapp->app_icon && wapp->app_icon->docked && wapp->app_icon->relaunching && wapp->main_window_desc->fake_group) wDockFinishLaunch(wapp->app_icon->dock, wapp->app_icon); return wapp; } wapp = wmalloc(sizeof(WApplication)); wapp->refcount = 1; wapp->last_focused = NULL; wapp->urgent_bounce_timer = NULL; wapp->last_workspace = 0; wapp->main_window = main_window; wapp->main_window_desc = makeMainWindow(scr, main_window); if (!wapp->main_window_desc) { wfree(wapp); return NULL; } wapp->main_window_desc->fake_group = wwin->fake_group; wapp->main_window_desc->net_icon_image = RRetainImage(wwin->net_icon_image); leader = wWindowFor(main_window); if (leader) leader->main_window = main_window; wapp->menu = wAppMenuGet(scr, main_window); #ifdef USER_MENU if (!wapp->menu) wapp->menu = wUserMenuGet(scr, wapp->main_window_desc); #endif /* Set application wide attributes from the leader */ wapp->flags.hidden = WFLAGP(wapp->main_window_desc, start_hidden); wapp->flags.emulated = WFLAGP(wapp->main_window_desc, emulate_appicon); /* application descriptor */ XSaveContext(dpy, main_window, wAppWinContext, (XPointer) wapp); create_appicon_for_application(wapp, wwin); return wapp; }
void wWorkspaceForceChange(WScreen * scr, int workspace) { WWindow *tmp, *foc = NULL, *foc2 = NULL; WWindow **toUnmap; int toUnmapSize, toUnmapCount; if (workspace >= MAX_WORKSPACES || workspace < 0) return; SendHelperMessage(scr, 'C', workspace + 1, NULL); if (workspace > w_global.workspace.count - 1) wWorkspaceMake(scr, workspace - w_global.workspace.count + 1); wClipUpdateForWorkspaceChange(scr, workspace); w_global.workspace.last_used = w_global.workspace.current; w_global.workspace.current = workspace; wWorkspaceMenuUpdate(w_global.workspace.menu); wWorkspaceMenuUpdate(w_global.clip.ws_menu); toUnmapSize = 16; toUnmapCount = 0; toUnmap = wmalloc(toUnmapSize * sizeof(WWindow *)); if ((tmp = scr->focused_window) != NULL) { if ((IS_OMNIPRESENT(tmp) && (tmp->flags.mapped || tmp->flags.shaded) && !WFLAGP(tmp, no_focusable)) || tmp->flags.changing_workspace) { foc = tmp; } /* foc2 = tmp; will fix annoyance with gnome panel * but will create annoyance for every other application */ while (tmp) { if (tmp->frame->workspace != workspace && !tmp->flags.selected) { /* unmap windows not on this workspace */ if ((tmp->flags.mapped || tmp->flags.shaded) && !IS_OMNIPRESENT(tmp) && !tmp->flags.changing_workspace) { if (toUnmapCount == toUnmapSize) { toUnmapSize *= 2; toUnmap = wrealloc(toUnmap, toUnmapSize * sizeof(WWindow *)); } toUnmap[toUnmapCount++] = tmp; } /* also unmap miniwindows not on this workspace */ if (!wPreferences.sticky_icons && tmp->flags.miniaturized && tmp->icon && !IS_OMNIPRESENT(tmp)) { XUnmapWindow(dpy, tmp->icon->core->window); tmp->icon->mapped = 0; } /* update current workspace of omnipresent windows */ if (IS_OMNIPRESENT(tmp)) { WApplication *wapp = wApplicationOf(tmp->main_window); tmp->frame->workspace = workspace; if (wapp) { wapp->last_workspace = workspace; } if (!foc2 && (tmp->flags.mapped || tmp->flags.shaded)) { foc2 = tmp; } } } else { /* change selected windows' workspace */ if (tmp->flags.selected) { wWindowChangeWorkspace(tmp, workspace); if (!tmp->flags.miniaturized && !foc) { foc = tmp; } } else { if (!tmp->flags.hidden) { if (!(tmp->flags.mapped || tmp->flags.miniaturized)) { /* remap windows that are on this workspace */ wWindowMap(tmp); if (!foc && !WFLAGP(tmp, no_focusable)) { foc = tmp; } } /* Also map miniwindow if not omnipresent */ if (!wPreferences.sticky_icons && tmp->flags.miniaturized && !IS_OMNIPRESENT(tmp) && tmp->icon) { tmp->icon->mapped = 1; XMapWindow(dpy, tmp->icon->core->window); } } } } tmp = tmp->prev; } while (toUnmapCount > 0) { wWindowUnmap(toUnmap[--toUnmapCount]); } wfree(toUnmap); /* Gobble up events unleashed by our mapping & unmapping. * These may trigger various grab-initiated focus & * crossing events. However, we don't care about them, * and ignore their focus implications altogether to avoid * flicker. */ scr->flags.ignore_focus_events = 1; ProcessPendingEvents(); scr->flags.ignore_focus_events = 0; if (!foc) foc = foc2; if (scr->focused_window->flags.mapped && !foc) { foc = scr->focused_window; } if (wPreferences.focus_mode == WKF_CLICK) { wSetFocusTo(scr, foc); } else { unsigned int mask; int foo; Window bar, win; WWindow *tmp; tmp = NULL; if (XQueryPointer(dpy, scr->root_win, &bar, &win, &foo, &foo, &foo, &foo, &mask)) { tmp = wWindowFor(win); } /* If there's a window under the pointer, focus it. * (we ate all other focus events above, so it's * certainly not focused). Otherwise focus last * focused, or the root (depending on sloppiness) */ if (!tmp && wPreferences.focus_mode == WKF_SLOPPY) { wSetFocusTo(scr, foc); } else { wSetFocusTo(scr, tmp); } } } /* We need to always arrange icons when changing workspace, even if * no autoarrange icons, because else the icons in different workspaces * can be superposed. * This can be avoided if appicons are also workspace specific. */ if (!wPreferences.sticky_icons) wArrangeIcons(scr, False); if (scr->dock) wAppIconPaint(scr->dock->icon_array[0]); if (!wPreferences.flags.noclip && (w_global.workspace.array[workspace]->clip->auto_collapse || w_global.workspace.array[workspace]->clip->auto_raise_lower)) { /* to handle enter notify. This will also */ XUnmapWindow(dpy, w_global.clip.icon->icon->core->window); XMapWindow(dpy, w_global.clip.icon->icon->core->window); } else if (w_global.clip.icon != NULL) { wClipIconPaint(); } wScreenUpdateUsableArea(scr); wNETWMUpdateDesktop(scr); showWorkspaceName(scr, workspace); WMPostNotificationName(WMNWorkspaceChanged, scr, (void *)(uintptr_t) workspace); /* XSync(dpy, False); */ }
static void revertSettings(WMWidget *button, void *client_data) { InspectorPanel *panel = (InspectorPanel *) client_data; WWindow *wwin = panel->inspected; WApplication *wapp = wApplicationOf(wwin->main_window); int i, n, workspace, level; char *wm_instance = NULL, *wm_class = NULL; /* Parameter not used, but tell the compiler that it is ok */ (void) button; if (panel->instRb && WMGetButtonSelected(panel->instRb) != 0) wm_instance = wwin->wm_instance; else if (panel->clsRb && WMGetButtonSelected(panel->clsRb) != 0) wm_class = wwin->wm_class; else if (panel->bothRb && WMGetButtonSelected(panel->bothRb) != 0) { wm_instance = wwin->wm_instance; wm_class = wwin->wm_class; } memset(&wwin->defined_user_flags, 0, sizeof(WWindowAttributes)); memset(&wwin->user_flags, 0, sizeof(WWindowAttributes)); memset(&wwin->client_flags, 0, sizeof(WWindowAttributes)); wWindowSetupInitialAttributes(wwin, &level, &workspace); for (i = 0; i < wlengthof(panel->attrChk); i++) { int flag = 0; switch (i) { case 0: flag = WFLAGP(wwin, no_titlebar); break; case 1: flag = WFLAGP(wwin, no_resizebar); break; case 2: flag = WFLAGP(wwin, no_close_button); break; case 3: flag = WFLAGP(wwin, no_miniaturize_button); break; case 4: flag = WFLAGP(wwin, no_border); break; case 5: flag = WFLAGP(wwin, floating); break; case 6: flag = WFLAGP(wwin, sunken); break; case 7: flag = WFLAGP(wwin, omnipresent); break; case 8: flag = WFLAGP(wwin, start_miniaturized); break; case 9: flag = WFLAGP(wwin, start_maximized != 0); break; case 10: flag = WFLAGP(wwin, full_maximize); break; } WMSetButtonSelected(panel->attrChk[i], flag); } for (i = 0; i < wlengthof(panel->moreChk); i++) { int flag = 0; switch (i) { case 0: flag = WFLAGP(wwin, no_bind_keys); break; case 1: flag = WFLAGP(wwin, no_bind_mouse); break; case 2: flag = WFLAGP(wwin, skip_window_list); break; case 3: flag = WFLAGP(wwin, skip_switchpanel); break; case 4: flag = WFLAGP(wwin, no_focusable); break; case 5: flag = WFLAGP(wwin, dont_move_off); break; case 6: flag = WFLAGP(wwin, no_hide_others); break; case 7: flag = WFLAGP(wwin, dont_save_session); break; case 8: flag = WFLAGP(wwin, emulate_appicon); break; case 9: flag = WFLAGP(wwin, focus_across_wksp); break; case 10: flag = WFLAGP(wwin, no_miniaturizable); break; #ifdef XKB_BUTTON_HINT case 11: flag = WFLAGP(wwin, no_language_button); break; #endif } WMSetButtonSelected(panel->moreChk[i], flag); } if (panel->appFrm && wapp) { for (i = 0; i < wlengthof(panel->appChk); i++) { int flag = 0; switch (i) { case 0: flag = WFLAGP(wapp->main_window_desc, start_hidden); break; case 1: flag = WFLAGP(wapp->main_window_desc, no_appicon); break; case 2: flag = WFLAGP(wapp->main_window_desc, shared_appicon); break; } WMSetButtonSelected(panel->appChk[i], flag); } } WMSetButtonSelected(panel->alwChk, WFLAGP(wwin, always_user_icon)); showIconFor(WMWidgetScreen(panel->alwChk), panel, wm_instance, wm_class, REVERT_TO_DEFAULT); n = wDefaultGetStartWorkspace(wm_instance, wm_class); if (n >= 0 && n < w_global.workspace.count) WMSetPopUpButtonSelectedItem(panel->wsP, n + 1); else WMSetPopUpButtonSelectedItem(panel->wsP, 0); /* must auto apply, so that there wno't be internal * inconsistencies between the state in the flags and * the actual state of the window */ applySettings(panel->applyBtn, panel); }
static void applySettings(WMWidget *button, void *client_data) { InspectorPanel *panel = (InspectorPanel *) client_data; WWindow *wwin = panel->inspected; WApplication *wapp = wApplicationOf(wwin->main_window); int floating, sunken, skip_window_list; int old_omnipresent, old_no_bind_keys, old_no_bind_mouse; old_omnipresent = WFLAGP(wwin, omnipresent); old_no_bind_keys = WFLAGP(wwin, no_bind_keys); old_no_bind_mouse = WFLAGP(wwin, no_bind_mouse); showIconFor(WMWidgetScreen(button), panel, NULL, NULL, USE_TEXT_FIELD); /* Attributes... --> Window Attributes */ WSETUFLAG(wwin, no_titlebar, WMGetButtonSelected(panel->attrChk[0])); WSETUFLAG(wwin, no_resizebar, WMGetButtonSelected(panel->attrChk[1])); WSETUFLAG(wwin, no_close_button, WMGetButtonSelected(panel->attrChk[2])); WSETUFLAG(wwin, no_miniaturize_button, WMGetButtonSelected(panel->attrChk[3])); WSETUFLAG(wwin, no_border, WMGetButtonSelected(panel->attrChk[4])); floating = WMGetButtonSelected(panel->attrChk[5]); sunken = WMGetButtonSelected(panel->attrChk[6]); WSETUFLAG(wwin, omnipresent, WMGetButtonSelected(panel->attrChk[7])); WSETUFLAG(wwin, start_miniaturized, WMGetButtonSelected(panel->attrChk[8])); WSETUFLAG(wwin, start_maximized, WMGetButtonSelected(panel->attrChk[9])); WSETUFLAG(wwin, full_maximize, WMGetButtonSelected(panel->attrChk[10])); /* Attributes... --> Advanced Options */ WSETUFLAG(wwin, no_bind_keys, WMGetButtonSelected(panel->moreChk[0])); WSETUFLAG(wwin, no_bind_mouse, WMGetButtonSelected(panel->moreChk[1])); skip_window_list = WMGetButtonSelected(panel->moreChk[2]); WSETUFLAG(wwin, skip_switchpanel, WMGetButtonSelected(panel->moreChk[3])); WSETUFLAG(wwin, no_focusable, WMGetButtonSelected(panel->moreChk[4])); WSETUFLAG(wwin, dont_move_off, WMGetButtonSelected(panel->moreChk[5])); WSETUFLAG(wwin, no_hide_others, WMGetButtonSelected(panel->moreChk[6])); WSETUFLAG(wwin, dont_save_session, WMGetButtonSelected(panel->moreChk[7])); WSETUFLAG(wwin, emulate_appicon, WMGetButtonSelected(panel->moreChk[8])); WSETUFLAG(wwin, focus_across_wksp, WMGetButtonSelected(panel->moreChk[9])); WSETUFLAG(wwin, no_miniaturizable, WMGetButtonSelected(panel->moreChk[10])); #ifdef XKB_BUTTON_HINT WSETUFLAG(wwin, no_language_button, WMGetButtonSelected(panel->moreChk[11])); #endif WSETUFLAG(wwin, always_user_icon, WMGetButtonSelected(panel->alwChk)); if (WFLAGP(wwin, no_titlebar) && wwin->flags.shaded) wUnshadeWindow(wwin); WSETUFLAG(wwin, no_shadeable, WFLAGP(wwin, no_titlebar)); if (floating) { if (!WFLAGP(wwin, floating)) ChangeStackingLevel(wwin->frame->core, WMFloatingLevel); } else if (sunken) { if (!WFLAGP(wwin, sunken)) ChangeStackingLevel(wwin->frame->core, WMSunkenLevel); } else { if (WFLAGP(wwin, floating) || WFLAGP(wwin, sunken)) ChangeStackingLevel(wwin->frame->core, WMNormalLevel); } WSETUFLAG(wwin, sunken, sunken); WSETUFLAG(wwin, floating, floating); wwin->flags.omnipresent = 0; if (WFLAGP(wwin, skip_window_list) != skip_window_list) { WSETUFLAG(wwin, skip_window_list, skip_window_list); UpdateSwitchMenu(wwin->screen_ptr, wwin, skip_window_list ? ACTION_REMOVE : ACTION_ADD); } else { if (WFLAGP(wwin, omnipresent) != old_omnipresent) WMPostNotificationName(WMNChangedState, wwin, "omnipresent"); } if (WFLAGP(wwin, no_bind_keys) != old_no_bind_keys) { if (WFLAGP(wwin, no_bind_keys)) XUngrabKey(dpy, AnyKey, AnyModifier, wwin->frame->core->window); else wWindowSetKeyGrabs(wwin); } if (WFLAGP(wwin, no_bind_mouse) != old_no_bind_mouse) wWindowResetMouseGrabs(wwin); wwin->frame->flags.need_texture_change = 1; wWindowConfigureBorders(wwin); wFrameWindowPaint(wwin->frame); wNETWMUpdateActions(wwin, False); /* Can't apply emulate_appicon because it will probably cause problems. */ if (wapp) { /* do application wide stuff */ WSETUFLAG(wapp->main_window_desc, start_hidden, WMGetButtonSelected(panel->appChk[0])); WSETUFLAG(wapp->main_window_desc, no_appicon, WMGetButtonSelected(panel->appChk[1])); WSETUFLAG(wapp->main_window_desc, shared_appicon, WMGetButtonSelected(panel->appChk[2])); if (WFLAGP(wapp->main_window_desc, no_appicon)) unpaint_app_icon(wapp); else paint_app_icon(wapp); char *file = WMGetTextFieldText(panel->fileText); if (file[0] == 0) { wfree(file); file = NULL; } /* If always_user_icon flag is set, but the user icon is not set * we use client supplied icon and we unset the flag */ if ((WFLAGP(wwin, always_user_icon) && (!file))) { /* Show the warning */ char *buf; int len = 100; buf = wmalloc(len); snprintf(buf, len, _("Ignore client supplied icon is set, but icon filename textbox is empty. Using client supplied icon")); wMessageDialog(panel->frame->screen_ptr, _("Warning"), buf, _("OK"), NULL, NULL); wfree(buf); wfree(file); /* Change the flags */ WSETUFLAG(wwin, always_user_icon, 0); WMSetButtonSelected(panel->alwChk, 0); } /* After test the always_user_icon flag value before, * the "else" block is used only if the flag is set and * the icon text box has an icon path */ if (!WFLAGP(wwin, always_user_icon)) { /* Change App Icon image, using the icon provided by the client */ if (wapp->app_icon) { RImage *image = get_rimage_icon_from_wm_hints(wapp->app_icon->icon); if (image) { set_icon_image_from_image(wapp->app_icon->icon, image); update_icon_pixmap(wapp->app_icon->icon); } else { wIconUpdate(wapp->app_icon->icon); } } /* Change icon image if the app is minimized, * using the icon provided by the client */ if (wwin->icon) { RImage *image = get_rimage_icon_from_wm_hints(wwin->icon); if (image) { set_icon_image_from_image(wwin->icon, image); update_icon_pixmap(wwin->icon); } else { wIconUpdate(wwin->icon); } } } else { /* Change App Icon image */ if (wapp->app_icon) wIconChangeImageFile(wapp->app_icon->icon, file); /* Change icon image if the app is minimized */ if (wwin->icon) wIconChangeImageFile(wwin->icon, file); } if (file) wfree(file); } wNETFrameExtents(wwin); }
static void create_tab_app_specific(WWindow *wwin, InspectorPanel *panel, int frame_width) { WScreen *scr = wwin->screen_ptr; int i = 0, flag = 0, tmp; char *caption = NULL, *descr = NULL; if (wwin->main_window != None) { WApplication *wapp = wApplicationOf(wwin->main_window); panel->appFrm = WMCreateFrame(panel->win); WMSetFrameTitle(panel->appFrm, _("Application Attributes")); WMMoveWidget(panel->appFrm, 15, 50); WMResizeWidget(panel->appFrm, frame_width, 240); for (i = 0; i < wlengthof(panel->appChk); i++) { switch (i) { case 0: caption = _("Start hidden"); flag = WFLAGP(wapp->main_window_desc, start_hidden); descr = _("Automatically hide application when it's started."); break; case 1: caption = _("No application icon"); flag = WFLAGP(wapp->main_window_desc, no_appicon); descr = _("Disable the application icon for the application.\n" "Note that you won't be able to dock it anymore,\n" "and any icons that are already docked will stop\n" "working correctly."); break; case 2: caption = _("Shared application icon"); flag = WFLAGP(wapp->main_window_desc, shared_appicon); descr = _("Use a single shared application icon for all of\n" "the instances of this application.\n"); break; } panel->appChk[i] = WMCreateSwitchButton(panel->appFrm); WMMoveWidget(panel->appChk[i], 10, 20 * (i + 1)); WMResizeWidget(panel->appChk[i], 205, 20); WMSetButtonSelected(panel->appChk[i], flag); WMSetButtonText(panel->appChk[i], caption); WMSetBalloonTextForView(descr, WMWidgetView(panel->appChk[i])); } if (WFLAGP(wwin, emulate_appicon)) { WMSetButtonEnabled(panel->appChk[1], False); WMSetButtonEnabled(panel->moreChk[7], True); } else { WMSetButtonEnabled(panel->appChk[1], True); WMSetButtonEnabled(panel->moreChk[7], False); } } else { if ((wwin->transient_for != None && wwin->transient_for != scr->root_win) || !wwin->wm_class || !wwin->wm_instance) tmp = False; else tmp = True; WMSetButtonEnabled(panel->moreChk[7], tmp); WMSetPopUpButtonItemEnabled(panel->pagePopUp, 4, False); panel->appFrm = NULL; } }
static void create_tab_icon_workspace(WWindow *wwin, InspectorPanel *panel) { int i = 0; /* miniwindow/workspace */ panel->iconFrm = WMCreateFrame(panel->win); WMMoveWidget(panel->iconFrm, 15, 50); WMResizeWidget(panel->iconFrm, PWIDTH - (2 * 15), 170); WMSetFrameTitle(panel->iconFrm, _("Miniwindow Image")); panel->iconLbl = WMCreateLabel(panel->iconFrm); WMMoveWidget(panel->iconLbl, PWIDTH - (2 * 15) - 22 - 64, 20); WMResizeWidget(panel->iconLbl, 64, 64); WMSetLabelRelief(panel->iconLbl, WRGroove); WMSetLabelImagePosition(panel->iconLbl, WIPImageOnly); panel->browseIconBtn = WMCreateCommandButton(panel->iconFrm); WMSetButtonAction(panel->browseIconBtn, chooseIconCallback, panel); WMMoveWidget(panel->browseIconBtn, 22, 32); WMResizeWidget(panel->browseIconBtn, 120, 26); WMSetButtonText(panel->browseIconBtn, _("Browse...")); panel->fileLbl = WMCreateLabel(panel->iconFrm); WMMoveWidget(panel->fileLbl, 20, 85); WMResizeWidget(panel->fileLbl, PWIDTH - (2 * 15) - (2 * 20), 14); WMSetLabelText(panel->fileLbl, _("Icon filename:")); panel->fileText = WMCreateTextField(panel->iconFrm); WMMoveWidget(panel->fileText, 20, 105); WMResizeWidget(panel->fileText, PWIDTH - (2 * 20) - (2 * 15), 20); WMSetTextFieldText(panel->fileText, NULL); WMAddNotificationObserver(textEditedObserver, panel, WMTextDidEndEditingNotification, panel->fileText); panel->alwChk = WMCreateSwitchButton(panel->iconFrm); WMMoveWidget(panel->alwChk, 20, 130); WMResizeWidget(panel->alwChk, PWIDTH - (2 * 15) - (2 * 15), 30); WMSetButtonText(panel->alwChk, _("Ignore client supplied icon")); WMSetButtonSelected(panel->alwChk, WFLAGP(wwin, always_user_icon)); panel->wsFrm = WMCreateFrame(panel->win); WMMoveWidget(panel->wsFrm, 15, 225); WMResizeWidget(panel->wsFrm, PWIDTH - (2 * 15), 70); WMSetFrameTitle(panel->wsFrm, _("Initial Workspace")); WMSetBalloonTextForView(_("The workspace to place the window when it's" "first shown."), WMWidgetView(panel->wsFrm)); panel->wsP = WMCreatePopUpButton(panel->wsFrm); WMMoveWidget(panel->wsP, 20, 30); WMResizeWidget(panel->wsP, PWIDTH - (2 * 15) - (2 * 20), 20); WMAddPopUpButtonItem(panel->wsP, _("Nowhere in particular")); for (i = 0; i < w_global.workspace.count; i++) WMAddPopUpButtonItem(panel->wsP, w_global.workspace.array[i]->name); i = wDefaultGetStartWorkspace(wwin->wm_instance, wwin->wm_class); if (i >= 0 && i <= w_global.workspace.count) WMSetPopUpButtonSelectedItem(panel->wsP, i + 1); else WMSetPopUpButtonSelectedItem(panel->wsP, 0); }
static void create_tab_window_advanced(WWindow *wwin, InspectorPanel *panel, int frame_width) { int i = 0; char *caption = NULL, *descr = NULL; int flag = 0; panel->moreFrm = WMCreateFrame(panel->win); WMSetFrameTitle(panel->moreFrm, _("Advanced")); WMMoveWidget(panel->moreFrm, 15, 45); WMResizeWidget(panel->moreFrm, frame_width, 265); for (i = 0; i < wlengthof(panel->moreChk); i++) { switch (i) { case 0: caption = _("Do not bind keyboard shortcuts"); flag = WFLAGP(wwin, no_bind_keys); descr = _("Do not bind keyboard shortcuts from Window Maker\n" "when this window is focused. This will allow the\n" "window to receive all key combinations regardless\n" "of your shortcut configuration."); break; case 1: caption = _("Do not bind mouse clicks"); flag = WFLAGP(wwin, no_bind_mouse); descr = _("Do not bind mouse actions, such as `Alt'+drag\n" "in the window (when alt is the modifier you have\n" "configured)."); break; case 2: caption = _("Do not show in the window list"); flag = WFLAGP(wwin, skip_window_list); descr = _("Do not list the window in the window list menu."); break; case 3: caption = _("Do not show in the switch panel"); flag = WFLAGP(wwin, skip_switchpanel); descr = _("Do not include in switch panel while cycling windows."); break; case 4: caption = _("Do not let it take focus"); flag = WFLAGP(wwin, no_focusable); descr = _("Do not let the window take keyboard focus when you\n" "click on it."); break; case 5: caption = _("Keep inside screen"); flag = WFLAGP(wwin, dont_move_off); descr = _("Do not allow the window to move itself completely\n" "outside the screen. For bug compatibility.\n"); break; case 6: caption = _("Ignore 'Hide Others'"); flag = WFLAGP(wwin, no_hide_others); descr = _("Do not hide the window when issuing the\n" "`HideOthers' command."); break; case 7: caption = _("Ignore 'Save Session'"); flag = WFLAGP(wwin, dont_save_session); descr = _("Do not save the associated application in the\n" "session's state, so that it won't be restarted\n" "together with other applications when Window Maker\n" "starts."); break; case 8: caption = _("Emulate application icon"); flag = WFLAGP(wwin, emulate_appicon); descr = _("Make this window act as an application that provides\n" "enough information to Window Maker for a dockable\n" "application icon to be created."); break; case 9: caption = _("Focus across workspaces"); flag = WFLAGP(wwin, focus_across_wksp); descr = _("Allow Window Maker to switch workspace to satisfy\n" "a focus request (annoying)."); break; case 10: caption = _("Do not let it be minimized"); flag = WFLAGP(wwin, no_miniaturizable); descr = _("Do not let the window of this application be\n" "minimized.\n"); break; #ifdef XKB_BUTTON_HINT case 11: caption = _("Disable language button"); flag = WFLAGP(wwin, no_language_button); descr = _("Remove the `toggle language' button of the window."); break; #endif } panel->moreChk[i] = WMCreateSwitchButton(panel->moreFrm); WMMoveWidget(panel->moreChk[i], 10, 20 * (i + 1)); WMResizeWidget(panel->moreChk[i], frame_width - 15, 20); WMSetButtonSelected(panel->moreChk[i], flag); WMSetButtonText(panel->moreChk[i], caption); WMSetBalloonTextForView(descr, WMWidgetView(panel->moreChk[i])); } }
static void create_tab_window_attributes(WWindow *wwin, InspectorPanel *panel, int frame_width) { int i = 0; char *caption = NULL, *descr = NULL; int flag = 0; panel->attrFrm = WMCreateFrame(panel->win); WMSetFrameTitle(panel->attrFrm, _("Attributes")); WMMoveWidget(panel->attrFrm, 15, 45); WMResizeWidget(panel->attrFrm, frame_width, 250); for (i = 0; i < wlengthof(panel->attrChk); i++) { switch (i) { case 0: caption = _("Disable titlebar"); flag = WFLAGP(wwin, no_titlebar); descr = _("Remove the titlebar of this window.\n" "To access the window commands menu of a window\n" "without it's titlebar, press Control+Esc (or the\n" "equivalent shortcut, if you changed the default\n" "settings)."); break; case 1: caption = _("Disable resizebar"); flag = WFLAGP(wwin, no_resizebar); descr = _("Remove the resizebar of this window."); break; case 2: caption = _("Disable close button"); flag = WFLAGP(wwin, no_close_button); descr = _("Remove the `close window' button of this window."); break; case 3: caption = _("Disable miniaturize button"); flag = WFLAGP(wwin, no_miniaturize_button); descr = _("Remove the `miniaturize window' button of the window."); break; case 4: caption = _("Disable border"); flag = WFLAGP(wwin, no_border); descr = _("Remove the 1 pixel black border around the window."); break; case 5: caption = _("Keep on top (floating)"); flag = WFLAGP(wwin, floating); descr = _("Keep the window over other windows, not allowing\n" "them to cover it."); break; case 6: caption = _("Keep at bottom (sunken)"); flag = WFLAGP(wwin, sunken); descr = _("Keep the window under all other windows."); break; case 7: caption = _("Omnipresent"); flag = WFLAGP(wwin, omnipresent); descr = _("Make window present in all workspaces."); break; case 8: caption = _("Start miniaturized"); flag = WFLAGP(wwin, start_miniaturized); descr = _("Make the window be automatically miniaturized when it's\n" "first shown."); break; case 9: caption = _("Start maximized"); flag = WFLAGP(wwin, start_maximized != 0); descr = _("Make the window be automatically maximized when it's\n" "first shown."); break; case 10: caption = _("Full screen maximization"); flag = WFLAGP(wwin, full_maximize); descr = _("Make the window use the whole screen space when it's\n" "maximized. The titlebar and resizebar will be moved\n" "to outside the screen."); break; } panel->attrChk[i] = WMCreateSwitchButton(panel->attrFrm); WMMoveWidget(panel->attrChk[i], 10, 20 * (i + 1)); WMResizeWidget(panel->attrChk[i], frame_width - 15, 20); WMSetButtonSelected(panel->attrChk[i], flag); WMSetButtonText(panel->attrChk[i], caption); WMSetBalloonTextForView(descr, WMWidgetView(panel->attrChk[i])); } }