static void onredraw(int width, int height) {
size_t fheight = x11_font_height(Font);
size_t fwidth = x11_font_width(Font);
- onupdate(); // Let the user program update the status and such
+
/* layout and draw the three text regions */
+ onupdate(); // Let the user program update the status and such
layout(width, height);
+ onupdate(); // Let the user program update the status and such
+
for (int i = 0; i < SCROLL; i++) {
View* view = win_view(i);
x11_draw_rect((i == TAGS ? CLR_BASE02 : CLR_BASE03),
x11_draw_rect(CLR_BASE01, Regions[SCROLL].width, Regions[SCROLL].y - 2, 1, Regions[SCROLL].height);
x11_draw_rect(CLR_BASE00, 0, Regions[SCROLL].y - 2, Regions[SCROLL].width, thumbreg);
x11_draw_rect(CLR_BASE03, 0, thumboff, Regions[SCROLL].width, thumbsz);
-
+
/* place the cursor on screen */
if (Regions[Focused].csrx != SIZE_MAX && Regions[Focused].csry != SIZE_MAX) {
x11_draw_rect(CLR_BASE3,
static void selnotify(XEvent* evnt);
static void selrequest(XEvent* evnt);
-#ifndef MAXFONTS
-#define MAXFONTS 16
-#endif
-
struct XFont {
struct {
int height;
fd_set fds;
int xfd = ConnectionNumber(X.display);
for (XEvent e; Running;) {
- struct timeval tv = { .tv_usec = 100000 };
+ /* configure for 100ms timeout */
+ struct timeval tv = { .tv_usec = 50000 };
FD_ZERO(&fds);
FD_SET(xfd, &fds);
-
+
+ /* wait for events with a timeout, then handle them if we got any */
int ready = select(xfd+1, &fds, NULL, NULL, &tv);
- if (ready > 0)
+ if (ready > 0) {
x11_handle_events();
-
- if (Running) {
- /* redraw the window */
Config->redraw(X.width, X.height);
XCopyArea(X.display, X.pixmap, X.window, X.gc, 0, 0, X.width, X.height, 0, 0);
+ } else {
XFlush(X.display);
}
-
}
XCloseDisplay(X.display);
/* we're exiting now. If we own the clipboard, make sure it persists */
strncat(status, path, remlen);
win_settext(STATUS, status_bytes);
win_view(STATUS)->selection = (Sel){0,0,0};
-
/* calculate and update scroll region */
View* view = win_view(EDIT);