static void showData(_Panel *panel) { WMPerformButtonClick(panel->scrB[GetSpeedForKey("MenuScrollSpeed")]); if (GetBoolForKey("AlignSubmenus")) WMPerformButtonClick(panel->aliyB); else WMPerformButtonClick(panel->alinB); WMSetButtonSelected(panel->wrapB, GetBoolForKey("WrapMenus")); WMSetButtonSelected(panel->autoB, GetBoolForKey("ScrollableMenus")); }
static void pushDockButton(WMWidget *w, void *data) { _Panel *panel = (_Panel *) data; WMButton *button = (WMButton *) w; if (button == panel->docksB[0] && !WMGetButtonSelected(panel->docksB[0])) { WMSetButtonSelected(panel->docksB[2], False); } if (button == panel->docksB[2] && WMGetButtonSelected(panel->docksB[2])) { WMSetButtonSelected(panel->docksB[0], True); } }
static void showData(_Panel * panel) { char *str; int i; char buffer[32]; str = GetStringForKey("FocusMode"); if (!str) str = "manual"; if (strcasecmp(str, "manual") == 0 || strcasecmp(str, "clicktofocus") == 0) WMSetButtonSelected(panel->kfocB[0], 1); else if (strcasecmp(str, "auto") == 0 || strcasecmp(str, "semiauto") == 0 || strcasecmp(str, "sloppy") == 0) WMSetButtonSelected(panel->kfocB[1], 1); else { wwarning(_("bad option value %s for option FocusMode. Using default Manual"), str); WMSetButtonSelected(panel->kfocB[0], 1); } /**/ str = GetStringForKey("ColormapMode"); if (!str) str = "auto"; if (strcasecmp(str, "manual") == 0 || strcasecmp(str, "clicktofocus") == 0) { WMPerformButtonClick(panel->manB); } else if (strcasecmp(str, "auto") == 0 || strcasecmp(str, "focusfollowsmouse") == 0) { WMPerformButtonClick(panel->autB); } else { wwarning(_("bad option value %s for option ColormapMode. Using default Auto"), str); WMPerformButtonClick(panel->manB); } /**/ i = GetIntegerForKey("RaiseDelay"); sprintf(buffer, "%i", i); WMSetTextFieldText(panel->raisT, buffer); switch (i) { case 0: WMPerformButtonClick(panel->raisB[0]); break; case 10: WMPerformButtonClick(panel->raisB[1]); break; case 100: WMPerformButtonClick(panel->raisB[2]); break; case 350: WMPerformButtonClick(panel->raisB[3]); break; case 800: WMPerformButtonClick(panel->raisB[4]); break; } /**/ WMSetButtonSelected(panel->ignB, GetBoolForKey("IgnoreFocusClick")); WMSetButtonSelected(panel->newB, GetBoolForKey("AutoFocus")); WMSetButtonSelected(panel->craisB, GetBoolForKey("CirculateRaise")); }
static void showData(_Panel *panel) { char *str; WMPerformButtonClick(panel->icoB[GetSpeedForKey("IconSlideSpeed")]); WMPerformButtonClick(panel->shaB[GetSpeedForKey("ShadeSpeed")]); str = GetStringForKey("NewStyle"); if (str && strcasecmp(str, "next") == 0) { WMPerformButtonClick(panel->nextB); } else if (str && strcasecmp(str, "old") == 0) { WMPerformButtonClick(panel->oldsB); } else { WMPerformButtonClick(panel->newsB); } WMSetButtonSelected(panel->animB, !GetBoolForKey("DisableAnimations")); WMSetButtonSelected(panel->supB, GetBoolForKey("Superfluous")); WMSetButtonSelected(panel->smoB, GetBoolForKey("SmoothWorkspaceBack")); WMSetButtonSelected(panel->dithB, GetBoolForKey("DisableDithering")); WMSetSliderValue(panel->dithS, GetIntegerForKey("ColormapSize")); updateLabel(panel->dithS, panel); }
static void showData(_Panel *panel) { char *value; int i; for (i = 0; i < 4; i++) { value = GetStringForKey(auto_delay[i].key); WMSetTextFieldText(panel->autoDelayT[i], value); adjustButtonSelectionBasedOnValue(panel, i, value); } for (i = 0; i < 3; i++) { WMSetButtonSelected(panel->docksB[i], !GetBoolForKey(dock_config[i].disable_key)); } }
static void raiseTextChanged(void *observerData, WMNotification * notification) { _Panel *panel = (_Panel *) observerData; int i; /* Parameter not used, but tell the compiler that it is ok */ (void) notification; if (panel->raiseDelaySelected) { for (i = 0; i < 5; i++) { WMSetButtonSelected(panel->raisB[i], False); } panel->raiseDelaySelected = 0; } }
static void adjustButtonSelectionBasedOnValue(_Panel *panel, int row, const char *value) { int j; if (!value) return; for (j = 0; j < 5; j++) { int isThatOne = !strcmp(autoDelayPresetValues[j], value); WMSetButtonSelected(panel->autoDelayB[row][j], isThatOne); if (isThatOne) return; } }
static void showData(_Panel * panel) { char *str; int i; int a = -1, b = -1; float accel; char buffer[32]; Display *dpy = WMScreenDisplay(WMWidgetScreen(panel->parent)); for (i = 0; i < wlengthof(button_list); i++) { int action; str = GetStringForKey(button_list[i].db_key); if (button_list[i].type == T_BUTTON) action = getButtonAction(str); else action = getWheelAction(str); if (action < 0) { if (action == -1) wwarning(_("bad value %s for option %s"), str, button_list[i].db_key); action = button_list[i].default_action; } WMSetPopUpButtonSelectedItem(panel->mouse_action[i].popup, action); } WMSetButtonSelected(panel->disaB, GetBoolForKey("DisableWSMouseActions")); toggle_disabling_of_mouse_actions(panel->disaB, panel); /**/ getMouseParameters(dpy, &accel, &a); panel->maxThreshold = WidthOfScreen(DefaultScreenOfDisplay(dpy)); if (a > panel->maxThreshold) { panel->maxThreshold = a; } sprintf(buffer, "%i", a); WMSetTextFieldText(panel->threT, buffer); WMSetSliderValue(panel->speedS, (accel - 0.25F) / 0.25F); panel->acceleration = accel; sprintf(buffer, "%.2f", (double)accel); WMSetTextFieldText(panel->acceT, buffer); /**/ b = GetIntegerForKey("DoubleClickTime"); /* find best match */ a = -1; for (i = 0; i < wlengthof(panel->ddelaB); i++) { if (DELAY(i) == b) a = i; } if (a >= 0) WMPerformButtonClick(panel->ddelaB[a]); sprintf(buffer, "%i", b); WMSetTextFieldText(panel->ddelaT, buffer); /**/ str = GetStringForKey("ModifierKey"); if (!str) str = "mod1"; a = ModifierFromKey(dpy, str); if (a != -1) { str = modifierNames[a]; a = 0; for (i = 0; i < WMGetPopUpButtonNumberOfItems(panel->grabP); i++) { if (strstr(WMGetPopUpButtonItem(panel->grabP, i), str)) { WMSetPopUpButtonSelectedItem(panel->grabP, i); a = 1; break; } } } if (a < 1) { char *previous; previous = WMGetPopUpButtonItem(panel->grabP, 0); if (previous != NULL) WMSetPopUpButtonSelectedItem(panel->grabP, 0); wwarning(_("modifier key %s for option ModifierKey was not recognized. Using %s as default"), str, previous?previous:"(empty)"); } }
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 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])); } }
static InspectorPanel *createInspectorForWindow(WWindow *wwin, int xpos, int ypos, Bool showSelectPanel) { WScreen *scr = wwin->screen_ptr; InspectorPanel *panel; Window parent; char *str = NULL, *tmp = NULL; int x, y, btn_width, frame_width; WMButton *selectedBtn = NULL; spec_text = _("The configuration will apply to all\n" "windows that have their WM_CLASS\n" "property set to the above selected\n" "name, when saved."); panel = wmalloc(sizeof(InspectorPanel)); memset(panel, 0, sizeof(InspectorPanel)); panel->destroyed = 0; panel->inspected = wwin; panel->nextPtr = panelList; panelList = panel; panel->win = WMCreateWindow(scr->wmscreen, "windowInspector"); WMResizeWidget(panel->win, PWIDTH, PHEIGHT); /**** create common stuff ****/ /* command buttons */ btn_width = (PWIDTH - (2 * 15) - (2 * 10)) / 3; panel->saveBtn = WMCreateCommandButton(panel->win); WMSetButtonAction(panel->saveBtn, saveSettings, panel); WMMoveWidget(panel->saveBtn, (2 * (btn_width + 10)) + 15, PHEIGHT - 40); WMSetButtonText(panel->saveBtn, _("Save")); WMResizeWidget(panel->saveBtn, btn_width, 28); if (wPreferences.flags.noupdates || !(wwin->wm_class || wwin->wm_instance)) WMSetButtonEnabled(panel->saveBtn, False); panel->applyBtn = WMCreateCommandButton(panel->win); WMSetButtonAction(panel->applyBtn, applySettings, panel); WMMoveWidget(panel->applyBtn, btn_width + 10 + 15, PHEIGHT - 40); WMSetButtonText(panel->applyBtn, _("Apply")); WMResizeWidget(panel->applyBtn, btn_width, 28); panel->revertBtn = WMCreateCommandButton(panel->win); WMSetButtonAction(panel->revertBtn, revertSettings, panel); WMMoveWidget(panel->revertBtn, 15, PHEIGHT - 40); WMSetButtonText(panel->revertBtn, _("Reload")); WMResizeWidget(panel->revertBtn, btn_width, 28); /* page selection popup button */ panel->pagePopUp = WMCreatePopUpButton(panel->win); WMSetPopUpButtonAction(panel->pagePopUp, changePage, panel); WMMoveWidget(panel->pagePopUp, 25, 15); WMResizeWidget(panel->pagePopUp, PWIDTH - 50, 20); WMAddPopUpButtonItem(panel->pagePopUp, _("Window Specification")); WMAddPopUpButtonItem(panel->pagePopUp, _("Window Attributes")); WMAddPopUpButtonItem(panel->pagePopUp, _("Advanced Options")); WMAddPopUpButtonItem(panel->pagePopUp, _("Icon and Initial Workspace")); WMAddPopUpButtonItem(panel->pagePopUp, _("Application Specific")); /**** window spec ****/ frame_width = PWIDTH - (2 * 15); panel->specFrm = WMCreateFrame(panel->win); WMSetFrameTitle(panel->specFrm, _("Window Specification")); WMMoveWidget(panel->specFrm, 15, 65); WMResizeWidget(panel->specFrm, frame_width, 145); panel->defaultRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->defaultRb, 10, 78); WMResizeWidget(panel->defaultRb, frame_width - (2 * 10), 20); WMSetButtonText(panel->defaultRb, _("Defaults for all windows")); WMSetButtonSelected(panel->defaultRb, False); WMSetButtonAction(panel->defaultRb, selectSpecification, panel); if (wwin->wm_class && wwin->wm_instance) { tmp = wstrconcat(wwin->wm_instance, "."); str = wstrconcat(tmp, wwin->wm_class); panel->bothRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->bothRb, 10, 18); WMResizeWidget(panel->bothRb, frame_width - (2 * 10), 20); WMSetButtonText(panel->bothRb, str); wfree(tmp); wfree(str); WMGroupButtons(panel->defaultRb, panel->bothRb); if (!selectedBtn) selectedBtn = panel->bothRb; WMSetButtonAction(panel->bothRb, selectSpecification, panel); } if (wwin->wm_instance) { panel->instRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->instRb, 10, 38); WMResizeWidget(panel->instRb, frame_width - (2 * 10), 20); WMSetButtonText(panel->instRb, wwin->wm_instance); WMGroupButtons(panel->defaultRb, panel->instRb); if (!selectedBtn) selectedBtn = panel->instRb; WMSetButtonAction(panel->instRb, selectSpecification, panel); } if (wwin->wm_class) { panel->clsRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->clsRb, 10, 58); WMResizeWidget(panel->clsRb, frame_width - (2 * 10), 20); WMSetButtonText(panel->clsRb, wwin->wm_class); WMGroupButtons(panel->defaultRb, panel->clsRb); if (!selectedBtn) selectedBtn = panel->clsRb; WMSetButtonAction(panel->clsRb, selectSpecification, panel); } panel->selWinB = WMCreateCommandButton(panel->specFrm); WMMoveWidget(panel->selWinB, 20, 145 - 24 - 10); WMResizeWidget(panel->selWinB, frame_width - 2 * 10 - 20, 24); WMSetButtonText(panel->selWinB, _("Select window")); WMSetButtonAction(panel->selWinB, selectWindow, panel); panel->specLbl = WMCreateLabel(panel->win); WMMoveWidget(panel->specLbl, 15, 210); WMResizeWidget(panel->specLbl, frame_width, 100); WMSetLabelText(panel->specLbl, spec_text); WMSetLabelWraps(panel->specLbl, True); WMSetLabelTextAlignment(panel->specLbl, WALeft); /**** attributes ****/ create_tab_window_attributes(wwin, panel, frame_width); create_tab_window_advanced(wwin, panel, frame_width); create_tab_icon_workspace(wwin, panel); create_tab_app_specific(wwin, panel, frame_width); /* if the window is a transient, don't let it have a miniaturize button */ if (wwin->transient_for != None && wwin->transient_for != scr->root_win) WMSetButtonEnabled(panel->attrChk[3], False); else WMSetButtonEnabled(panel->attrChk[3], True); if (!wwin->wm_class && !wwin->wm_instance) WMSetPopUpButtonItemEnabled(panel->pagePopUp, 0, False); WMRealizeWidget(panel->win); WMMapSubwidgets(panel->win); WMMapSubwidgets(panel->specFrm); WMMapSubwidgets(panel->attrFrm); WMMapSubwidgets(panel->moreFrm); WMMapSubwidgets(panel->iconFrm); WMMapSubwidgets(panel->wsFrm); if (panel->appFrm) WMMapSubwidgets(panel->appFrm); if (showSelectPanel) { WMSetPopUpButtonSelectedItem(panel->pagePopUp, 0); changePage(panel->pagePopUp, panel); } else { WMSetPopUpButtonSelectedItem(panel->pagePopUp, 1); changePage(panel->pagePopUp, panel); } parent = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, PWIDTH, PHEIGHT, 0, 0, 0); XSelectInput(dpy, parent, KeyPressMask | KeyReleaseMask); panel->parent = parent; XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0); WMMapWidget(panel->win); XSetTransientForHint(dpy, parent, wwin->client_win); if (xpos == UNDEFINED_POS) { x = wwin->frame_x + wwin->frame->core->width / 2; y = wwin->frame_y + wwin->frame->top_width * 2; if (y + PHEIGHT > scr->scr_height) y = scr->scr_height - PHEIGHT - 30; if (x + PWIDTH > scr->scr_width) x = scr->scr_width - PWIDTH; } else { x = xpos; y = ypos; } panel->frame = wManageInternalWindow(scr, parent, wwin->client_win, "Inspector", x, y, PWIDTH, PHEIGHT); if (!selectedBtn) selectedBtn = panel->defaultRb; WMSetButtonSelected(selectedBtn, True); selectSpecification(selectedBtn, panel); /* kluge to know who should get the key events */ panel->frame->client_leader = WMWidgetXID(panel->win); WSETUFLAG(panel->frame, no_closable, 0); WSETUFLAG(panel->frame, no_close_button, 0); wWindowUpdateButtonImages(panel->frame); wFrameWindowShowButton(panel->frame->frame, WFF_RIGHT_BUTTON); panel->frame->frame->on_click_right = destroyInspector; wWindowMap(panel->frame); showIconFor(WMWidgetScreen(panel->alwChk), panel, wwin->wm_instance, wwin->wm_class, UPDATE_TEXT_FIELD); return 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 menuItemSelected(WEditMenuDelegate * delegate, WEditMenu * menu, WEditMenuItem * item) { ItemData *data = WGetEditMenuItemData(item); _Panel *panel = (_Panel *) delegate->data; /* Parameter not used, but tell the compiler that it is ok */ (void) menu; panel->currentItem = item; if (data) { changeInfoType(panel, WGetEditMenuItemTitle(item), data->type); switch (data->type) { case NoInfo: break; case ExecInfo: WMSetTextFieldText(panel->commandT, data->param.exec.command); WMSetTextFieldText(panel->shortT, data->param.exec.shortcut); break; case CommandInfo: WMSelectListItem(panel->icommandL, data->param.command.command); WMSetListPosition(panel->icommandL, data->param.command.command - 2); WMSetTextFieldText(panel->shortT, data->param.command.shortcut); switch (data->param.command.command) { case 3: case 4: WMSetButtonSelected(panel->quickB, data->param.command.parameter != NULL); break; case 6: WMSetTextFieldText(panel->paramT, data->param.command.parameter); break; } icommandLClicked(panel->icommandL, panel); break; case PipeInfo: WMSetTextFieldText(panel->pipeT, data->param.pipe.command); WMSetButtonSelected(panel->pipeCacheB, data->param.pipe.cached); break; case PLPipeInfo: WMSetTextFieldText(panel->plpipeT, data->param.pipe.command); WMSetButtonSelected(panel->plpipeCacheB, data->param.pipe.cached); break; case ExternalInfo: WMSetTextFieldText(panel->pathT, data->param.external.path); break; case DirectoryInfo: WMSetTextFieldText(panel->dpathT, data->param.directory.directory); WMSetTextFieldText(panel->dcommandT, data->param.directory.command); WMSetButtonSelected(panel->dstripB, data->param.directory.stripExt); break; case WSMenuInfo: break; default: break; } } }
void ShowDockAppSettingsPanel(WAppIcon * aicon) { AppSettingsPanel *panel; WScreen *scr = aicon->icon->core->screen_ptr; Window parent; WMFont *font; int x, y; WMBox *vbox; panel = wmalloc(sizeof(AppSettingsPanel)); panel->editedIcon = aicon; aicon->panel = panel; aicon->editing = 1; panel->win = WMCreateWindow(scr->wmscreen, "applicationSettings"); WMResizeWidget(panel->win, PWIDTH, PHEIGHT); panel->iconLabel = WMCreateLabel(panel->win); WMResizeWidget(panel->iconLabel, 64, 64); WMMoveWidget(panel->iconLabel, 10, 10); WMSetLabelImagePosition(panel->iconLabel, WIPImageOnly); panel->nameLabel = WMCreateLabel(panel->win); WMResizeWidget(panel->nameLabel, 190, 18); WMMoveWidget(panel->nameLabel, 80, 35); WMSetLabelTextAlignment(panel->nameLabel, WALeft); font = WMBoldSystemFontOfSize(scr->wmscreen, 14); WMSetLabelFont(panel->nameLabel, font); WMReleaseFont(font); if (aicon->wm_class && strcmp(aicon->wm_class, "DockApp") == 0) WMSetLabelText(panel->nameLabel, aicon->wm_instance); else WMSetLabelText(panel->nameLabel, aicon->wm_class); vbox = WMCreateBox(panel->win); WMResizeWidget(vbox, PWIDTH - 20, PHEIGHT - 84 - 10); WMMoveWidget(vbox, 10, 84); panel->autoLaunchBtn = WMCreateSwitchButton(vbox); WMAddBoxSubview(vbox, WMWidgetView(panel->autoLaunchBtn), False, True, 20, 20, 2); WMSetButtonText(panel->autoLaunchBtn, _("Start when Window Maker is started")); WMSetButtonSelected(panel->autoLaunchBtn, aicon->auto_launch); panel->lockBtn = WMCreateSwitchButton(vbox); WMAddBoxSubview(vbox, WMWidgetView(panel->lockBtn), False, True, 20, 20, 5); WMSetButtonText(panel->lockBtn, _("Lock (prevent accidental removal)")); WMSetButtonSelected(panel->lockBtn, aicon->lock); panel->commandFrame = WMCreateFrame(vbox); WMSetFrameTitle(panel->commandFrame, _("Application path and arguments")); WMAddBoxSubview(vbox, WMWidgetView(panel->commandFrame), False, True, 50, 50, 5); panel->commandField = WMCreateTextField(panel->commandFrame); WMResizeWidget(panel->commandField, 256, 20); WMMoveWidget(panel->commandField, 10, 20); WMSetTextFieldText(panel->commandField, aicon->command); WMMapSubwidgets(panel->commandFrame); panel->pasteCommandFrame = WMCreateFrame(vbox); WMSetFrameTitle(panel->pasteCommandFrame, _("Command for middle-click launch")); WMAddBoxSubview(vbox, WMWidgetView(panel->pasteCommandFrame), False, True, 70, 70, 5); panel->pasteCommandField = WMCreateTextField(panel->pasteCommandFrame); WMResizeWidget(panel->pasteCommandField, 256, 20); WMMoveWidget(panel->pasteCommandField, 10, 20); panel->pasteCommandLabel = WMCreateLabel(panel->pasteCommandFrame); WMResizeWidget(panel->pasteCommandLabel, 256, 18); WMMoveWidget(panel->pasteCommandLabel, 10, 45); WMSetTextFieldText(panel->pasteCommandField, aicon->paste_command); WMSetLabelText(panel->pasteCommandLabel, _("%s will be replaced with current selection")); WMMapSubwidgets(panel->pasteCommandFrame); panel->dndCommandFrame = WMCreateFrame(vbox); WMSetFrameTitle(panel->dndCommandFrame, _("Command for files dropped with DND")); WMAddBoxSubview(vbox, WMWidgetView(panel->dndCommandFrame), False, True, 70, 70, 5); panel->dndCommandField = WMCreateTextField(panel->dndCommandFrame); WMResizeWidget(panel->dndCommandField, 256, 20); WMMoveWidget(panel->dndCommandField, 10, 20); panel->dndCommandLabel = WMCreateLabel(panel->dndCommandFrame); WMResizeWidget(panel->dndCommandLabel, 256, 18); WMMoveWidget(panel->dndCommandLabel, 10, 45); #ifdef XDND WMSetTextFieldText(panel->dndCommandField, aicon->dnd_command); WMSetLabelText(panel->dndCommandLabel, _("%d will be replaced with the file name")); #else WMSetTextFieldEditable(panel->dndCommandField, False); WMSetLabelText(panel->dndCommandLabel, _("DND support was not compiled in")); #endif WMMapSubwidgets(panel->dndCommandFrame); panel->iconFrame = WMCreateFrame(vbox); WMSetFrameTitle(panel->iconFrame, _("Icon Image")); WMAddBoxSubview(vbox, WMWidgetView(panel->iconFrame), False, True, 50, 50, 10); panel->iconField = WMCreateTextField(panel->iconFrame); WMResizeWidget(panel->iconField, 176, 20); WMMoveWidget(panel->iconField, 10, 20); WMSetTextFieldText(panel->iconField, wDefaultGetIconFile(aicon->wm_instance, aicon->wm_class, False)); panel->browseBtn = WMCreateCommandButton(panel->iconFrame); WMResizeWidget(panel->browseBtn, 70, 24); WMMoveWidget(panel->browseBtn, 195, 18); WMSetButtonText(panel->browseBtn, _("Browse...")); WMSetButtonAction(panel->browseBtn, chooseIconCallback, panel); { WMBox *hbox; hbox = WMCreateBox(vbox); WMSetBoxHorizontal(hbox, True); WMAddBoxSubview(vbox, WMWidgetView(hbox), False, True, 24, 24, 0); panel->okBtn = WMCreateCommandButton(hbox); WMSetButtonText(panel->okBtn, _("OK")); WMSetButtonAction(panel->okBtn, panelBtnCallback, panel); WMAddBoxSubviewAtEnd(hbox, WMWidgetView(panel->okBtn), False, True, 80, 80, 0); panel->cancelBtn = WMCreateCommandButton(hbox); WMSetButtonText(panel->cancelBtn, _("Cancel")); WMSetButtonAction(panel->cancelBtn, panelBtnCallback, panel); WMAddBoxSubviewAtEnd(hbox, WMWidgetView(panel->cancelBtn), False, True, 80, 80, 5); WMMapSubwidgets(hbox); } WMRealizeWidget(panel->win); WMMapSubwidgets(panel->win); WMMapSubwidgets(vbox); WMMapSubwidgets(panel->iconFrame); updateSettingsPanelIcon(panel); parent = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, PWIDTH, PHEIGHT, 0, 0, 0); XSelectInput(dpy, parent, KeyPressMask | KeyReleaseMask); XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0); /* * make things relative to head */ { WMRect rect = wGetRectForHead(scr, wGetHeadForPointerLocation(scr)); y = aicon->y_pos; if (y < 0) y = 0; else if (y + PHEIGHT > rect.pos.y + rect.size.height) y = rect.pos.y + rect.size.height - PHEIGHT - 30; if (aicon->dock && aicon->dock->type == WM_DOCK) { if (aicon->dock->on_right_side) x = rect.pos.x + rect.size.width / 2; else x = rect.pos.x + rect.size.width / 2 - PWIDTH - 2; } else { x = rect.pos.x + (rect.size.width - PWIDTH) / 2; } } panel->wwin = wManageInternalWindow(scr, parent, None, _("Docked Application Settings"), x, y, PWIDTH, PHEIGHT); panel->wwin->client_leader = WMWidgetXID(panel->win); panel->parent = parent; WMMapWidget(panel->win); wWindowMap(panel->wwin); }