|
Lines 420-480
on_frame_clock_before_paint (GdkFrameClock *clock,
|
Link Here
|
|---|
|
| 420 |
timings->predicted_presentation_time = presentation_time + refresh_interval; |
420 |
timings->predicted_presentation_time = presentation_time + refresh_interval; |
| 421 |
} |
421 |
} |
| 422 |
else |
422 |
else |
| 423 |
{ |
423 |
{ |
| 424 |
/* As above, but we don't actually know the phase of the vblank, |
424 |
/* As above, but we don't actually know the phase of the vblank, |
| 425 |
* so just assume that we're half way through a refresh cycle. |
425 |
* so just assume that we're half way through a refresh cycle. |
| 426 |
*/ |
426 |
*/ |
| 427 |
timings->predicted_presentation_time = timings->frame_time + refresh_interval / 2 + refresh_interval; |
427 |
timings->predicted_presentation_time = timings->frame_time + refresh_interval / 2 + refresh_interval; |
| 428 |
} |
428 |
} |
| 429 |
} |
429 |
} |
| 430 |
|
430 |
|
| 431 |
static void |
431 |
static void |
| 432 |
on_frame_clock_after_paint (GdkFrameClock *clock, |
432 |
on_frame_clock_after_paint (GdkFrameClock *clock, |
| 433 |
GdkWindow *window) |
433 |
GdkWindow *window) |
| 434 |
{ |
434 |
{ |
| 435 |
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); |
435 |
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); |
| 436 |
struct wl_callback *callback; |
436 |
struct wl_callback *callback; |
| 437 |
|
437 |
|
| 438 |
if (!impl->pending_commit) |
438 |
if (!impl->pending_commit) |
| 439 |
return; |
439 |
return; |
| 440 |
|
440 |
|
| 441 |
impl->pending_commit = FALSE; |
441 |
impl->pending_commit = FALSE; |
| 442 |
impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock); |
442 |
impl->pending_frame_counter = gdk_frame_clock_get_frame_counter (clock); |
| 443 |
impl->awaiting_frame = TRUE; |
443 |
impl->awaiting_frame = TRUE; |
| 444 |
|
444 |
|
| 445 |
callback = wl_surface_frame (impl->surface); |
445 |
callback = wl_surface_frame (impl->surface); |
| 446 |
wl_callback_add_listener (callback, &frame_listener, window); |
446 |
wl_callback_add_listener (callback, &frame_listener, window); |
| 447 |
_gdk_frame_clock_freeze (clock); |
447 |
_gdk_frame_clock_freeze (clock); |
| 448 |
|
448 |
|
| 449 |
wl_surface_commit (impl->surface); |
449 |
wl_surface_commit (impl->surface); |
| 450 |
if (_gdk_wayland_is_shm_surface (impl->cairo_surface)) |
450 |
if (_gdk_wayland_is_shm_surface (impl->cairo_surface) && !_gdk_wayland_shm_surface_get_busy (impl->cairo_surface)) |
| 451 |
_gdk_wayland_shm_surface_set_busy (impl->cairo_surface); |
451 |
_gdk_wayland_shm_surface_set_busy (impl->cairo_surface); |
| 452 |
|
452 |
|
| 453 |
g_signal_emit (impl, signals[COMMITTED], 0); |
453 |
g_signal_emit (impl, signals[COMMITTED], 0); |
| 454 |
} |
454 |
} |
| 455 |
|
455 |
|
| 456 |
static void |
456 |
static void |
| 457 |
window_update_scale (GdkWindow *window) |
457 |
window_update_scale (GdkWindow *window) |
| 458 |
{ |
458 |
{ |
| 459 |
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); |
459 |
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); |
| 460 |
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); |
460 |
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window)); |
| 461 |
guint32 scale; |
461 |
guint32 scale; |
| 462 |
GSList *l; |
462 |
GSList *l; |
| 463 |
|
463 |
|
| 464 |
if (wayland_display->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE) |
464 |
if (wayland_display->compositor_version < WL_SURFACE_HAS_BUFFER_SCALE) |
| 465 |
{ |
465 |
{ |
| 466 |
/* We can't set the scale on this surface */ |
466 |
/* We can't set the scale on this surface */ |
| 467 |
return; |
467 |
return; |
| 468 |
} |
468 |
} |
| 469 |
|
469 |
|
| 470 |
scale = 1; |
470 |
scale = 1; |
| 471 |
for (l = impl->outputs; l != NULL; l = l->next) |
471 |
for (l = impl->outputs; l != NULL; l = l->next) |
| 472 |
{ |
472 |
{ |
| 473 |
guint32 output_scale = |
473 |
guint32 output_scale = |
| 474 |
_gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data); |
474 |
_gdk_wayland_screen_get_output_scale (wayland_display->screen, l->data); |
| 475 |
scale = MAX (scale, output_scale); |
475 |
scale = MAX (scale, output_scale); |
| 476 |
} |
476 |
} |
| 477 |
|
477 |
|
| 478 |
/* Notify app that scale changed */ |
478 |
/* Notify app that scale changed */ |
| 479 |
gdk_wayland_window_configure (window, window->width, window->height, scale); |
479 |
gdk_wayland_window_configure (window, window->width, window->height, scale); |
| 480 |
} |
480 |
} |