1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

Added icon feature option to WPrefs: Enforce icon margin

The current findBestIcon function usually selects an icon image
that almost completely fills up the (default) 64x64 pixels of an
icon. As Dan noted in the function, the icon images should use only
75% of the available space, which would result in room for the
miniwindow title and better overall aesthetics.

This feature option provides for enabling such an automatic "icon
shrinking" functionality.

Note: This commit only introduces the new option, not the actual
      image shrinking.
This commit is contained in:
Tim Taenny
2019-01-31 17:34:29 +01:00
committed by Carlos R. Mafra
parent 9b5eaa3d3e
commit d6c1ac3ecf
3 changed files with 15 additions and 1 deletions

View File

@@ -79,6 +79,7 @@ typedef struct _Panel {
WMButton *arrB;
WMButton *omnB;
WMButton *sclB;
WMButton *marginB;
struct {
WMFrame *frame;
@@ -173,6 +174,7 @@ static void showData(_Panel * panel)
WMSetButtonSelected(panel->arrB, GetBoolForKey("AutoArrangeIcons"));
WMSetButtonSelected(panel->omnB, GetBoolForKey("StickyIcons"));
WMSetButtonSelected(panel->sclB, GetBoolForKey("SingleClickLaunch"));
WMSetButtonSelected(panel->marginB, GetBoolForKey("EnforceIconMargin"));
str = GetStringForKey("IconPosition");
if (str != NULL) {
@@ -387,7 +389,7 @@ static void createPanel(Panel * p)
WMResizeWidget(panel->optF, 215, 148);
WMMoveWidget(panel->optF, 292, 72);
/* WMSetFrameTitle(panel->optF, _("Icon Display")); */
starty = 8 + 27; /* the last term centers the checkboxes within the panel; subtract 13 for a new option */
starty = 8 + 14; /* the last term centers the checkboxes within the panel; subtract 13 for a new option */
panel->arrB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->arrB, 198, 26);
@@ -413,6 +415,14 @@ static void createPanel(Panel * p)
WMSetBalloonTextForView(_("Launch applications and restore windows with a single click."), WMWidgetView(panel->sclB));
panel->marginB = WMCreateSwitchButton(panel->optF);
WMResizeWidget(panel->marginB, 198, 26);
WMMoveWidget(panel->marginB, 12, starty);
starty += 26;
WMSetButtonText(panel->marginB, _("Enforce icon margin"));
WMSetBalloonTextForView(_("Make sure that the icon image does not protrude into the icon frame."), WMWidgetView(panel->marginB));
WMMapSubwidgets(panel->optF);
WMRealizeWidget(panel->box);
@@ -428,6 +438,7 @@ static void storeData(_Panel * panel)
SetBoolForKey(WMGetButtonSelected(panel->arrB), "AutoArrangeIcons");
SetBoolForKey(WMGetButtonSelected(panel->omnB), "StickyIcons");
SetBoolForKey(WMGetButtonSelected(panel->sclB), "SingleClickLaunch");
SetBoolForKey(WMGetButtonSelected(panel->marginB), "EnforceIconMargin");
SetIntegerForKey(WMGetPopUpButtonSelectedItem(panel->sizeP) * 8 + 24, "IconSize");

View File

@@ -376,6 +376,7 @@ extern struct WPreferences {
char disable_root_mouse; /* disable button events in root window */
char auto_focus; /* focus window when it's mapped */
char *icon_back_file; /* background image for icons */
char enforce_icon_margin; /* auto-shrink icon images */
WCoord *root_menu_pos; /* initial position of the root menu*/
WCoord *app_menu_pos;

View File

@@ -363,6 +363,8 @@ WDefaultEntry optionList[] = {
&wPreferences.icon_yard, getEnum, setIconPosition, NULL, NULL},
{"IconificationStyle", "Zoom", seIconificationStyles,
&wPreferences.iconification_style, getEnum, NULL, NULL, NULL},
{"EnforceIconMargin", "NO", NULL,
&wPreferences.enforce_icon_margin, getBool, NULL, NULL, NULL},
{"DisableWSMouseActions", "NO", NULL,
&wPreferences.disable_root_mouse, getBool, NULL, NULL, NULL},
{"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions,