Skip to content

Commit

Permalink
[window-buttons] Fix for unfocused state not showing
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielfin authored and flexiondotorg committed Jun 30, 2019
1 parent 9698039 commit 64bfd81
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
18 changes: 10 additions & 8 deletions window-buttons-applet/window-button.vala
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace WindowWidgets{
}
}

public void update(bool reset = false){
public void update(bool theme_change = false){

IconType type;
if(_button_type == WindowButtonType.MINIMIZE)
Expand All @@ -96,14 +96,22 @@ namespace WindowWidgets{


IconState state;
if(!reset && _window != null && !_window.is_active())
if(_window != null && !_window.is_active())
state = IconState.UNFOCUSED;
else
state = IconState.FOCUSED;


Gdk.Pixbuf? icon = theme.get_icon(type, state, _current_action);

// If this is a new theme, and it doesn't have an icon for the current state and action, then reset
// everything, otherwise we would be showing the icons of the old theme
if(theme_change && icon == null){
state = IconState.FOCUSED;
_current_action = IconAction.NORMAL;

icon = theme.get_icon(type, state, _current_action);
}

if(icon != null){
icon = icon.scale_simple(_icon_size, _icon_size, Gdk.InterpType.HYPER);
Expand All @@ -123,12 +131,6 @@ namespace WindowWidgets{
this.update();
}

public void reload(){
_current_action = IconAction.NORMAL;

this.update(true);
}

}

public enum WindowButtonType{
Expand Down
18 changes: 9 additions & 9 deletions window-buttons-applet/window-buttons-applet.vala
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ namespace WindowButtonsApplet{
if((Wnck.WindowActions.CLOSE & actions)>0){
CLOSE.set_visible(true);
CLOSE.window = window;
CLOSE.reload();
CLOSE.update();
} else CLOSE.set_visible(false);
}

if(enabled_buttons.minimize == true){
if((Wnck.WindowActions.MINIMIZE & actions)>0){
MINIMIZE.set_visible(true);
MINIMIZE.window = window;
MINIMIZE.reload();
MINIMIZE.update();
} else MINIMIZE.set_visible(false);
}

if(enabled_buttons.maximize == true){
if((Wnck.WindowActions.MAXIMIZE & actions)>0){
MAXIMIZE.set_visible(true);
MAXIMIZE.window = window;
MAXIMIZE.reload();
MAXIMIZE.update();
} else MAXIMIZE.set_visible(false);
}
}
Expand Down Expand Up @@ -160,15 +160,15 @@ namespace WindowButtonsApplet{

CLOSE.theme = theme;
if(enabled_buttons.close)
CLOSE.reload();
CLOSE.update(true);

MINIMIZE.theme = theme;
if(enabled_buttons.minimize)
MINIMIZE.reload();
MINIMIZE.update(true);

MAXIMIZE.theme = theme;
if(enabled_buttons.maximize)
MAXIMIZE.reload();
MAXIMIZE.update(true);

}

Expand All @@ -178,15 +178,15 @@ namespace WindowButtonsApplet{

CLOSE.icon_size = size;
if(this.enabled_buttons.close == true)
CLOSE.reload();
CLOSE.update();

MINIMIZE.icon_size = size;
if(this.enabled_buttons.minimize == true)
MINIMIZE.reload();
MINIMIZE.update();

MAXIMIZE.icon_size = size;
if(this.enabled_buttons.maximize == true)
MAXIMIZE.reload();
MAXIMIZE.update();

}

Expand Down

0 comments on commit 64bfd81

Please sign in to comment.