Skip to content

Commit

Permalink
Decimate number of frame paintings.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Mar 16, 2020
1 parent 2cd75e5 commit a287348
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/wmframe.cc
Expand Up @@ -903,12 +903,18 @@ void YFrameWindow::handleFocus(const XFocusChangeEvent &focus) {
}

bool YFrameWindow::handleTimer(YTimer *t) {
if (t == fAutoRaiseTimer) {
if (t == fFrameTimer) {
if (visible()) {
paint(getGraphics(), geometry());
}
}
else if (t == fAutoRaiseTimer) {
if (canRaise())
wmRaise();
}
if (t == fDelayFocusTimer)
else if (t == fDelayFocusTimer) {
focus(false);
}
return false;
}

Expand Down Expand Up @@ -1632,7 +1638,20 @@ MiniIcon *YFrameWindow::getMiniIcon() {
return fMiniIcon;
}

void YFrameWindow::paint(Graphics &g, const YRect &/*r*/) {
void YFrameWindow::repaint() {
bool yes = (visible() && hasbit(frameDecors(), fdResize | fdBorder));
if (yes) {
fFrameTimer->setTimer(10L, this, true);
}
}

void YFrameWindow::handleExpose(const XExposeEvent &expose) {
if (expose.count == 0) {
repaint();
}
}

void YFrameWindow::paint(Graphics &g, const YRect& r) {
if (g.rdepth() != depth()) {
tlog("YFrameWindow::%s: attempt to use gc of depth %d on window 0x%lx of depth %d\n",
__func__, g.rdepth(), handle(), depth());
Expand Down
3 changes: 3 additions & 0 deletions src/wmframe.h
Expand Up @@ -55,6 +55,7 @@ class YFrameWindow:
virtual void handleCrossing(const XCrossingEvent &crossing);
virtual void handleFocus(const XFocusChangeEvent &focus);
virtual void handleConfigure(const XConfigureEvent &configure);
virtual void handleExpose(const XExposeEvent &expose);

virtual bool handleTimer(YTimer *t);

Expand Down Expand Up @@ -489,6 +490,7 @@ class YFrameWindow:

static lazy<YTimer> fAutoRaiseTimer;
static lazy<YTimer> fDelayFocusTimer;
lazy<YTimer> fFrameTimer;

int fWinWorkspace;
long fWinRequestedLayer;
Expand Down Expand Up @@ -547,6 +549,7 @@ class YFrameWindow:
// only focus if mouse moves
//static int fMouseFocusX, fMouseFocusY;

void repaint();
void setGeometry(const YRect &);
void setPosition(int, int);
void setSize(int, int);
Expand Down

0 comments on commit a287348

Please sign in to comment.