Fixed changes to _XROOTPMAP_ID not updating background with "xroot" transparency
This commit is contained in:
@@ -129,6 +129,7 @@ static Display* get_x11_display(void) { return glfwGetX
|
|||||||
static Window get_x11_window (GLFWwindow* w) { return glfwGetX11Window(w); }
|
static Window get_x11_window (GLFWwindow* w) { return glfwGetX11Window(w); }
|
||||||
static bool should_close (GLFWwindow* w) { return glfwWindowShouldClose(w); }
|
static bool should_close (GLFWwindow* w) { return glfwWindowShouldClose(w); }
|
||||||
static bool should_render (GLFWwindow* w) { return true; }
|
static bool should_render (GLFWwindow* w) { return true; }
|
||||||
|
static bool bg_changed (GLFWwindow* w) { return false; }
|
||||||
static void get_fbsize (GLFWwindow* w, int* d, int* h) { glfwGetFramebufferSize(w, d, h); }
|
static void get_fbsize (GLFWwindow* w, int* d, int* h) { glfwGetFramebufferSize(w, d, h); }
|
||||||
static void get_pos (GLFWwindow* w, int* x, int* y) { glfwGetWindowPos(w, x, y); }
|
static void get_pos (GLFWwindow* w, int* x, int* y) { glfwGetWindowPos(w, x, y); }
|
||||||
static double get_time (GLFWwindow* w) { return glfwGetTime(); }
|
static double get_time (GLFWwindow* w) { return glfwGetTime(); }
|
||||||
|
|||||||
16
glx_wcb.c
16
glx_wcb.c
@@ -175,11 +175,11 @@ struct glxwin {
|
|||||||
Window w;
|
Window w;
|
||||||
GLXContext context;
|
GLXContext context;
|
||||||
double time;
|
double time;
|
||||||
bool should_close, should_render, clickthrough;
|
bool should_close, should_render, bg_changed, clickthrough;
|
||||||
char override_state;
|
char override_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Atom ATOM__MOTIF_WM_HINTS, ATOM_WM_DELETE_WINDOW, ATOM_WM_PROTOCOLS, ATOM__NET_ACTIVE_WINDOW;
|
static Atom ATOM__MOTIF_WM_HINTS, ATOM_WM_DELETE_WINDOW, ATOM_WM_PROTOCOLS, ATOM__NET_ACTIVE_WINDOW, ATOM__XROOTPMAP_ID;
|
||||||
|
|
||||||
static void init(void) {
|
static void init(void) {
|
||||||
display = XOpenDisplay(NULL);
|
display = XOpenDisplay(NULL);
|
||||||
@@ -232,6 +232,7 @@ static void init(void) {
|
|||||||
intern(WM_DELETE_WINDOW, true);
|
intern(WM_DELETE_WINDOW, true);
|
||||||
intern(WM_PROTOCOLS, true);
|
intern(WM_PROTOCOLS, true);
|
||||||
intern(_NET_ACTIVE_WINDOW, false);
|
intern(_NET_ACTIVE_WINDOW, false);
|
||||||
|
intern(_XROOTPMAP_ID, false);
|
||||||
|
|
||||||
#undef intern
|
#undef intern
|
||||||
#undef resolve
|
#undef resolve
|
||||||
@@ -279,6 +280,7 @@ static void* create_and_bind(const char* name, const char* class,
|
|||||||
.time = 0.0D,
|
.time = 0.0D,
|
||||||
.should_close = false,
|
.should_close = false,
|
||||||
.should_render = true,
|
.should_render = true,
|
||||||
|
.bg_changed = false,
|
||||||
.clickthrough = false
|
.clickthrough = false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -432,7 +434,8 @@ static void* create_and_bind(const char* name, const char* class,
|
|||||||
|
|
||||||
if (glXSwapIntervalEXT) glXSwapIntervalEXT(display, drawable, swap);
|
if (glXSwapIntervalEXT) glXSwapIntervalEXT(display, drawable, swap);
|
||||||
|
|
||||||
// XSelectInput(display, DefaultRootWindow(display), VisibilityChangeMask | PropertyChangeMask);
|
if (!transparent)
|
||||||
|
XSelectInput(display, DefaultRootWindow(display), PropertyChangeMask);
|
||||||
|
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@@ -488,6 +491,7 @@ static void set_visible(struct glxwin* w, bool visible) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool should_close (struct glxwin* w) { return w->should_close; }
|
static bool should_close (struct glxwin* w) { return w->should_close; }
|
||||||
|
static bool bg_changed (struct glxwin* w) { return w->bg_changed; }
|
||||||
static bool should_render(struct glxwin* w) {
|
static bool should_render(struct glxwin* w) {
|
||||||
/* For nearly all window managers, windows are 'minimized' by unmapping parent windows.
|
/* For nearly all window managers, windows are 'minimized' by unmapping parent windows.
|
||||||
VisibilityNotify events are not sent in these instances, so we have to read window
|
VisibilityNotify events are not sent in these instances, so we have to read window
|
||||||
@@ -523,6 +527,12 @@ static void swap_buffers(struct glxwin* w) {
|
|||||||
fprintf(stderr, "Invalid VisibilityNotify event state (%d)\n", ev.xvisibility.state);
|
fprintf(stderr, "Invalid VisibilityNotify event state (%d)\n", ev.xvisibility.state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case PropertyNotify:
|
||||||
|
if (ev.xproperty.atom == ATOM__XROOTPMAP_ID) {
|
||||||
|
w->bg_changed = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
render.c
2
render.c
@@ -1422,7 +1422,7 @@ bool rd_update(struct renderer* r, float* lb, float* rb, size_t bsz, bool modifi
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Resize and grab new background data if needed */
|
/* Resize and grab new background data if needed */
|
||||||
if (gl->copy_desktop && (ww != gl->lww || wh != gl->lwh || wx != gl->lwx || wy != gl->lwy)) {
|
if (gl->copy_desktop && (gl->wcb->bg_changed(gl->w) || ww != gl->lww || wh != gl->lwh || wx != gl->lwx || wy != gl->lwy)) {
|
||||||
gl->bg_tex = xwin_copyglbg(r, gl->bg_tex);
|
gl->bg_tex = xwin_copyglbg(r, gl->bg_tex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
render.h
2
render.h
@@ -34,6 +34,7 @@ struct gl_wcb {
|
|||||||
bool clickthrough);
|
bool clickthrough);
|
||||||
bool (*should_close) (void* ptr);
|
bool (*should_close) (void* ptr);
|
||||||
bool (*should_render) (void* ptr);
|
bool (*should_render) (void* ptr);
|
||||||
|
bool (*bg_changed) (void* ptr);
|
||||||
void (*swap_buffers) (void* ptr);
|
void (*swap_buffers) (void* ptr);
|
||||||
void (*raise) (void* ptr);
|
void (*raise) (void* ptr);
|
||||||
void (*destroy) (void* ptr);
|
void (*destroy) (void* ptr);
|
||||||
@@ -70,6 +71,7 @@ struct gl_wcb {
|
|||||||
WCB_FUNC(create_and_bind), \
|
WCB_FUNC(create_and_bind), \
|
||||||
WCB_FUNC(should_close), \
|
WCB_FUNC(should_close), \
|
||||||
WCB_FUNC(should_render), \
|
WCB_FUNC(should_render), \
|
||||||
|
WCB_FUNC(bg_changed), \
|
||||||
WCB_FUNC(swap_buffers), \
|
WCB_FUNC(swap_buffers), \
|
||||||
WCB_FUNC(raise), \
|
WCB_FUNC(raise), \
|
||||||
WCB_FUNC(destroy), \
|
WCB_FUNC(destroy), \
|
||||||
|
|||||||
Reference in New Issue
Block a user