Skip to content

Commit

Permalink
Add preference ToolTipIcon=1 for issue #637.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Dec 19, 2022
1 parent 598b7e1 commit ca95571
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions man/icewm-preferences.pod
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,10 @@ Delay before activating menu items.

Delay before activating menu submenus.

=item B<ToolTipIcon>=1

Show an application icon in toolbar and tray tooltips.

=item B<ToolTipDelay>=1000 [0-5000]

Delay before tooltip window is displayed.
Expand Down
1 change: 1 addition & 0 deletions src/default.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ cfoption icewm_preferences[] = {
OIV("MenuActivateDelay", &MenuActivateDelay, 0, 5000, "Delay in ms before activating menu items"),
OIV("SubmenuMenuActivateDelay", &SubmenuActivateDelay, 0, 5000, "Delay in ms before activating menu submenus"),
OIV("MenuMaximalWidth", &MenuMaximalWidth, 0, 16384, "Maximal width of popup menus, 2/3 of the screen's width if set to zero"),
OBV("ToolTipIcon", &ToolTipIcon, "Show an application icon in toolbar and tray tooltips"),
OIV("ToolTipDelay", &ToolTipDelay, 0, 5000, "Delay in ms before tooltip window is displayed"),
OIV("ToolTipTime", &ToolTipTime, 0, 60000, "Time in ms before tooltip window is hidden (0 means never)"),
OIV("AutoHideDelay", &autoHideDelay, 0, 5000, "Delay in ms before task bar is hidden"),
Expand Down
10 changes: 6 additions & 4 deletions src/themes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ void DTheme::open() {
smActionListener->handleSMAction(ICEWM_ACTION_RESTARTWM);
}

ThemesMenu::ThemesMenu(IApp *app, YSMListener *smActionListener, YActionListener *wmActionListener, YWindow *parent): ObjectMenu(wmActionListener, parent) {
themeCount = 0;
this->app = app;
this->smActionListener = smActionListener;
ThemesMenu::ThemesMenu(IApp *app, YSMListener *smActionListener, YActionListener *wmActionListener, YWindow *parent)
: ObjectMenu(wmActionListener, parent)
, themeCount(0)
, smActionListener(smActionListener)
, app(app)
{
}

void ThemesMenu::updatePopup() {
Expand Down
1 change: 1 addition & 0 deletions src/yprefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ XIV(int, autoScrollStartDelay, 500)
XIV(int, autoScrollDelay, 60)
XIV(int, ToolTipDelay, 500)
XIV(int, ToolTipTime, 0)
XIV(bool, ToolTipIcon, true)

///#warning "move this one back to WM"
XIV(bool, grabRootWindow, true)
Expand Down
10 changes: 6 additions & 4 deletions src/ytooltip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void YToolTipWindow::paint(Graphics& g, const YRect& /*r*/) {
g.setColor(toolTipFg);
g.drawStringMultiline(fText, TTXMargin, y, width() - 2 * TTXMargin);
}
if (fIcon != null) {
if (ToolTipIcon && fIcon != null) {
int y = int(height() - hugeIconSize) - TTYMargin;
int x = int(width() - hugeIconSize) / 2;
fIcon->draw(g, x, y, hugeIconSize);
Expand All @@ -59,14 +59,15 @@ void YToolTipWindow::paint(Graphics& g, const YRect& /*r*/) {

void YToolTipWindow::setText(mstring tip, ref<YIcon> icon) {
fText = tip;
fIcon = icon;
if (ToolTipIcon)
fIcon = icon;
unsigned w = 0, h = 0;
if (toolTipFont) {
YDimension size(toolTipFont->multilineAlloc(fText));
w += size.w;
h += size.h + 3;
}
if (fIcon != null) {
if (ToolTipIcon && fIcon != null) {
h += hugeIconSize;
w = max(w, hugeIconSize);
}
Expand All @@ -77,7 +78,8 @@ void YToolTipWindow::setText(mstring tip, ref<YIcon> icon) {

void YToolTip::setText(mstring tip, ref<YIcon> icon) {
fText = tip;
fIcon = icon;
if (ToolTipIcon)
fIcon = icon;
if (fWindow) {
fWindow->setText(tip, icon);
fWindow->locate(fLocate);
Expand Down

0 comments on commit ca95571

Please sign in to comment.