ENH: page faults when device page idle

jira: [none]
Change-Id: I4dc95ae6332b81e571fb5ef09c75dcf01e77170e
(cherry picked from commit cefe973772c7f7045713470d61cc85221574d9c5)
This commit is contained in:
xin.zhang
2025-09-19 18:02:08 +08:00
committed by Noisyfox
parent 16a6138263
commit 420bdc8907
9 changed files with 91 additions and 40 deletions

View File

@@ -63,9 +63,11 @@ bool Button::Create(wxWindow* parent, wxString text, wxString icon, long style,
void Button::SetLabel(const wxString& label)
{
wxWindow::SetLabel(label);
messureSize();
Refresh();
if (label != wxWindow::GetLabel()) {
wxWindow::SetLabel(label);
messureSize();
Refresh();
}
}
bool Button::SetFont(const wxFont& font)

View File

@@ -31,8 +31,10 @@ CheckBox::CheckBox(wxWindow *parent, int id)
void CheckBox::SetValue(bool value)
{
wxBitmapToggleButton::SetValue(value);
update();
if (wxBitmapToggleButton::GetValue() != value) {
wxBitmapToggleButton::SetValue(value);
update();
}
}
void CheckBox::SetHalfChecked(bool value)

View File

@@ -51,6 +51,16 @@ public:
// single color
StateColor(unsigned long color);
// operator==
bool operator==(StateColor const& other) const{
return statesList_ == other.statesList_ && colors_ == other.colors_ && takeFocusedAsHovered_ == other.takeFocusedAsHovered_;
};
// operator!=
bool operator!=(StateColor const& other) const{
return !(*this == other);
};
public:
void append(wxColour const & color, int states);

View File

@@ -66,9 +66,11 @@ void StaticBox::SetBorderWidth(int width)
void StaticBox::SetBorderColor(StateColor const &color)
{
border_color = color;
state_handler.update_binds();
Refresh();
if (border_color != color) {
border_color = color;
state_handler.update_binds();
Refresh();
}
}
void StaticBox::SetBorderColorNormal(wxColor const &color)
@@ -118,11 +120,13 @@ wxColor StaticBox::GetParentBackgroundColor(wxWindow* parent)
void StaticBox::ShowBadge(bool show)
{
if (show)
if (show && badge.name() != "badge") {
badge = ScalableBitmap(this, "badge", 18);
else
Refresh();
} else if (!show && !badge.name().empty()) {
badge = ScalableBitmap {};
Refresh();
Refresh();
}
}
void StaticBox::eraseEvent(wxEraseEvent& evt)

View File

@@ -9,11 +9,13 @@ StaticGroup::StaticGroup(wxWindow *parent, wxWindowID id, const wxString &label)
void StaticGroup::ShowBadge(bool show)
{
if (show)
if (show && badge.name() != "badge") {
badge = ScalableBitmap(this, "badge", 18);
else
Refresh();
} else if (!show && !badge.name().empty()) {
badge = ScalableBitmap{};
Refresh();
Refresh();
}
}
void StaticGroup::DrawBorderAndLabel(wxDC& dc)

View File

@@ -51,9 +51,11 @@ void StepCtrlBase::SelectItem(int item)
void StepCtrlBase::Idle()
{
step = -1;
sendStepCtrlEvent();
Refresh();
if (step != -1) {
step = -1;
sendStepCtrlEvent();
Refresh();
}
}
bool StepCtrlBase::SetTipFont(wxFont const& font)

View File

@@ -62,9 +62,10 @@ void SwitchButton::SetThumbColor(StateColor const& color)
void SwitchButton::SetValue(bool value)
{
if (value != GetValue())
wxBitmapToggleButton::SetValue(value);
update();
if (value != GetValue()) {
wxBitmapToggleButton::SetValue(value);
update();
}
}
bool SwitchButton::SetBackgroundColour(const wxColour& colour)
@@ -212,17 +213,30 @@ SwitchBoard::SwitchBoard(wxWindow *parent, wxString leftL, wxString right, wxSiz
void SwitchBoard::updateState(wxString target)
{
if (target.empty()) {
if (!switch_left && !switch_right) {
return;
}
switch_left = false;
switch_right = false;
} else {
if (target == "left") {
if (switch_left && !switch_right) {
return;
}
switch_left = true;
switch_right = false;
} else if (target == "right") {
if (!switch_left && switch_right) {
return;
}
switch_left = false;
switch_right = true;
}
}
Refresh();
}