Codechange: Set specific widgets dirty instead of window.

pull/332/head
Peter Nelson 3 years ago committed by PeterN
parent e2774354b4
commit 8321ef0061

@ -557,7 +557,7 @@ struct AboutWindow : public Window {
if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - lengthof(_credits) * this->line_height)) { if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - lengthof(_credits) * this->line_height)) {
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y; this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
} }
this->SetDirty(); this->SetWidgetDirty(WID_A_SCROLLING_TEXT);
} }
} }
}; };

@ -789,7 +789,7 @@ struct MusicWindow : public Window {
byte &vol = (widget == WID_M_MUSIC_VOL) ? _settings_client.music.music_vol : _settings_client.music.effect_vol; byte &vol = (widget == WID_M_MUSIC_VOL) ? _settings_client.music.music_vol : _settings_client.music.effect_vol;
if (ClickVolumeSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, vol)) { if (ClickVolumeSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, vol)) {
if (widget == WID_M_MUSIC_VOL) MusicDriver::GetInstance()->SetVolume(vol); if (widget == WID_M_MUSIC_VOL) MusicDriver::GetInstance()->SetVolume(vol);
this->SetDirty(); this->SetWidgetDirty(widget);
SetWindowClassesDirty(WC_GAME_OPTIONS); SetWindowClassesDirty(WC_GAME_OPTIONS);
} }

@ -446,17 +446,18 @@ struct GameOptionsWindow : Window {
ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, WL_ERROR); ShowErrorMessage(STR_ERROR_FULLSCREEN_FAILED, INVALID_STRING_ID, WL_ERROR);
} }
this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen); this->SetWidgetLoweredState(WID_GO_FULLSCREEN_BUTTON, _fullscreen);
this->SetDirty(); this->SetWidgetDirty(WID_GO_FULLSCREEN_BUTTON);
break; break;
case WID_GO_VIDEO_ACCEL_BUTTON: case WID_GO_VIDEO_ACCEL_BUTTON:
_video_hw_accel = !_video_hw_accel; _video_hw_accel = !_video_hw_accel;
ShowErrorMessage(STR_GAME_OPTIONS_VIDEO_ACCELERATION_RESTART, INVALID_STRING_ID, WL_INFO); ShowErrorMessage(STR_GAME_OPTIONS_VIDEO_ACCELERATION_RESTART, INVALID_STRING_ID, WL_INFO);
this->SetWidgetLoweredState(WID_GO_VIDEO_ACCEL_BUTTON, _video_hw_accel); this->SetWidgetLoweredState(WID_GO_VIDEO_ACCEL_BUTTON, _video_hw_accel);
this->SetWidgetDirty(WID_GO_VIDEO_ACCEL_BUTTON);
#ifndef __APPLE__ #ifndef __APPLE__
this->SetWidgetDisabledState(WID_GO_VIDEO_VSYNC_BUTTON, !_video_hw_accel); this->SetWidgetDisabledState(WID_GO_VIDEO_VSYNC_BUTTON, !_video_hw_accel);
this->SetWidgetDirty(WID_GO_VIDEO_VSYNC_BUTTON);
#endif #endif
this->SetDirty();
break; break;
case WID_GO_VIDEO_VSYNC_BUTTON: case WID_GO_VIDEO_VSYNC_BUTTON:
@ -466,7 +467,7 @@ struct GameOptionsWindow : Window {
VideoDriver::GetInstance()->ToggleVsync(_video_vsync); VideoDriver::GetInstance()->ToggleVsync(_video_vsync);
this->SetWidgetLoweredState(WID_GO_VIDEO_VSYNC_BUTTON, _video_vsync); this->SetWidgetLoweredState(WID_GO_VIDEO_VSYNC_BUTTON, _video_vsync);
this->SetDirty(); this->SetWidgetDirty(WID_GO_VIDEO_VSYNC_BUTTON);
break; break;
case WID_GO_BASE_SFX_VOLUME: case WID_GO_BASE_SFX_VOLUME:
@ -474,7 +475,7 @@ struct GameOptionsWindow : Window {
byte &vol = (widget == WID_GO_BASE_MUSIC_VOLUME) ? _settings_client.music.music_vol : _settings_client.music.effect_vol; byte &vol = (widget == WID_GO_BASE_MUSIC_VOLUME) ? _settings_client.music.music_vol : _settings_client.music.effect_vol;
if (ClickVolumeSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, vol)) { if (ClickVolumeSliderWidget(this->GetWidget<NWidgetBase>(widget)->GetCurrentRect(), pt, vol)) {
if (widget == WID_GO_BASE_MUSIC_VOLUME) MusicDriver::GetInstance()->SetVolume(vol); if (widget == WID_GO_BASE_MUSIC_VOLUME) MusicDriver::GetInstance()->SetVolume(vol);
this->SetDirty(); this->SetWidgetDirty(widget);
SetWindowClassesDirty(WC_MUSIC_WINDOW); SetWindowClassesDirty(WC_MUSIC_WINDOW);
} }

@ -2438,8 +2438,8 @@ static EventState HandleActiveWidget()
if (w->mouse_capture_widget >= 0) { if (w->mouse_capture_widget >= 0) {
/* Abort if no button is clicked any more. */ /* Abort if no button is clicked any more. */
if (!_left_button_down) { if (!_left_button_down) {
w->SetWidgetDirty(w->mouse_capture_widget);
w->mouse_capture_widget = -1; w->mouse_capture_widget = -1;
w->SetDirty();
return ES_HANDLED; return ES_HANDLED;
} }

Loading…
Cancel
Save