Taskbar: thumbnails (small fixes and disable shm for now)

This commit is contained in:
o9000 2017-11-15 21:33:52 +01:00
parent 89ab1fa6c4
commit 5e6e1184fe
3 changed files with 8 additions and 8 deletions

View file

@ -649,7 +649,8 @@ void set_task_state(Task *task, TaskState state)
if (!task || state == TASK_UNDEFINED || state >= TASK_STATE_COUNT)
return;
task_refresh_thumbnail(task);
if (!task->thumbnail)
task_refresh_thumbnail(task);
taskbar_start_thumbnail_timer(TRUE);
if (state == TASK_ACTIVE && task->current_state != state) {

View file

@ -365,7 +365,7 @@ void taskbar_start_thumbnail_timer(gboolean fast)
{
if (!panel_config.g_task.thumbnail_enabled)
return;
change_timeout(&thumbnail_update_timer, 100, 10 * 1000, taskbar_update_thumbnails, (void*)(long)fast);
change_timeout(&thumbnail_update_timer, 500, 10 * 1000, taskbar_update_thumbnails, (void*)(long)fast);
}
void taskbar_init_fonts()

View file

@ -388,7 +388,7 @@ cairo_surface_t *screenshot(Window win, size_t size)
{
cairo_surface_t *result = NULL;
XWindowAttributes wa;
if (!XGetWindowAttributes(server.display, win, &wa) || wa.width <= 0 || wa.height <= 0)
if (!XGetWindowAttributes(server.display, win, &wa) || wa.width <= 0 || wa.height <= 0 || wa.map_state != IsViewable)
goto err0;
if (window_is_iconified(win))
@ -448,7 +448,8 @@ cairo_surface_t *screenshot(Window win, size_t size)
goto err4;
}
if (window_is_iconified(win))
XGetWindowAttributes(server.display, win, &wa);
if (wa.map_state != IsViewable)
goto err4;
result = cairo_image_surface_create(CAIRO_FORMAT_RGB24, (int)tw, (int)th);
@ -544,9 +545,7 @@ cairo_surface_t *get_window_thumbnail_cairo(Window win, int size)
{
static cairo_filter_t filter = CAIRO_FILTER_BEST;
XWindowAttributes wa;
if (!XGetWindowAttributes(server.display, win, &wa))
return NULL;
if (window_is_iconified(win))
if (!XGetWindowAttributes(server.display, win, &wa) || wa.width <= 0 || wa.height <= 0 || wa.map_state != IsViewable)
return NULL;
int w, h;
w = wa.width;
@ -616,7 +615,7 @@ gboolean cairo_surface_is_blank(cairo_surface_t *image_surface)
cairo_surface_t *get_window_thumbnail(Window win, int size)
{
cairo_surface_t *image_surface = NULL;
if (server.has_shm && server.composite_manager) {
if (0 && server.has_shm && server.composite_manager) {
image_surface = screenshot(win, (size_t)size);
if (image_surface && cairo_surface_is_blank(image_surface)) {
cairo_surface_destroy(image_surface);