Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ X11LIB = /usr/X11R6/lib
XINERAMALIBS = -lXinerama
XINERAMAFLAGS = -DXINERAMA

# XRandR
XRANDRLIBS = -lXrandr

# freetype
FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2
Expand All @@ -20,7 +23,7 @@ FREETYPEINC = /usr/include/freetype2

# includes and libs
INCS = -I$(X11INC) -I$(FREETYPEINC)
LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(FREETYPELIBS) -lm
LIBS = -L$(X11LIB) -lX11 $(XINERAMALIBS) $(XRANDRLIBS) $(FREETYPELIBS) -lm

# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XINERAMAFLAGS)
Expand Down
21 changes: 19 additions & 2 deletions instantmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifdef XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
#include <X11/extensions/Xrandr.h>
#include <X11/Xft/Xft.h>
#include <X11/cursorfont.h>
#include <X11/Xresource.h>
Expand Down Expand Up @@ -767,6 +768,14 @@ void animatesel() {
int time;
time = 0;
drw_setscheme(drw, scheme[SchemeSel]);

XRRScreenConfiguration *conf = XRRGetScreenInfo(dpy, RootWindow(dpy, 0));
short refresh_rate = XRRConfigCurrentRate(conf);

// scale the framerate properly for !=60Hz displays
framecount = framecount * (refresh_rate / 60);
double usecs = (1 / (double)refresh_rate) * 1000000;

while (time < framecount)
{
// bottom animation
Expand All @@ -776,7 +785,7 @@ void animatesel() {
drw_rect(drw, 0, sely + 4 - (easeOutQuint(((double)time/framecount)) * (sely + 4)), mw, (easeOutQuint(((double)time/framecount)) * sely), 1, 1, 0);
drw_map(drw, win, 0, 0, mw, mh);
time++;
usleep(19000);
usleep(usecs);
}
}

Expand All @@ -795,13 +804,21 @@ void animaterect(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
time = 0;
double timefactor = 0;
drw_setscheme(drw, scheme[SchemeSel]);

XRRScreenConfiguration *conf = XRRGetScreenInfo(dpy, RootWindow(dpy, 0));
short refresh_rate = XRRConfigCurrentRate(conf);

// scale the framerate properly for !=60Hz displays
framecount = framecount * (refresh_rate / 60);
double usecs = (1 / (double)refresh_rate) * 1000000;

while (time < framecount)
{
timefactor = easeOutQuint((double)time/framecount);
drw_rect(drw, x1 + (x2 - x1) * timefactor, y1 + (y2 - y1) * timefactor, w1 + (w2 - w1) * timefactor, h1 + (h2 - h1) * timefactor, 1, 1, 0);
drw_map(drw, win, 0, 0, mw, mh);
time++;
usleep(19000);
usleep(usecs);
}
}

Expand Down