@item use-frame-synchronization
If non-@code{nil}, synchronize the frame redisplay with the refresh
rate of the monitor to avoid graphics tearing. At present, this is
-only implemented on the X window system inside no-toolkit and X
-toolkit builds, does not work correctly with toolkit scroll bars, and
-requires a compositing manager supporting the relevant display
-synchronization protocols. The @code{synchronizeResize} X resource
-must also be set to the string @code{"extended"}.
+only implemented on Haiku and the X window system inside no-toolkit
+and X toolkit builds, does not work correctly with toolkit scroll
+bars, and requires a compositing manager supporting the relevant
+display synchronization protocols. The @code{synchronizeResize} X
+resource must also be set to the string @code{"extended"}.
@vindex inhibit-double-buffering@r{, a frame parameter}
@item inhibit-double-buffering
BMessage *wait_for_release_message;
int64 grabbed_buttons;
+ BScreen screen;
+ bool use_frame_synchronization;
EmacsView () : BView (BRect (0, 0, 0, 0), "Emacs",
B_FOLLOW_NONE, B_WILL_DRAW),
cr_context (NULL),
#endif
wait_for_release_message (NULL),
- grabbed_buttons (0)
+ grabbed_buttons (0),
+ use_frame_synchronization (false)
{
}
grab_view_locker.Unlock ();
}
+ void
+ SetFrameSynchronization (bool sync)
+ {
+ if (LockLooper ())
+ {
+ use_frame_synchronization = sync;
+ UnlockLooper ();
+ }
+ }
+
void
MessageReceived (BMessage *msg)
{
void
FlipBuffers (void)
{
+ EmacsWindow *w;
if (!LockLooper ())
gui_abort ("Failed to lock looper during buffer flip");
if (!offscreen_draw_view)
gui_abort ("Failed to lock offscreen view during buffer flip");
offscreen_draw_view->Sync ();
-
- EmacsWindow *w = (EmacsWindow *) Window ();
+ w = (EmacsWindow *) Window ();
w->shown_flag = 0;
if (copy_bitmap &&
if (copy_bitmap->InitCheck () != B_OK)
gui_abort ("Failed to init copy bitmap during buffer flip");
+ /* Wait for VBLANK. If responding to the invalidation or buffer
+ flipping takes longer than the blanking period, we lose. */
+ if (use_frame_synchronization)
+ screen.WaitForRetrace ();
+
Invalidate (&invalid_region);
invalid_region.MakeEmpty ();
UnlockLooper ();
grab_view_locker.Unlock ();
}
}
+
+void
+be_set_use_frame_synchronization (void *view, bool sync)
+{
+ EmacsView *vw;
+
+ vw = (EmacsView *) view;
+ vw->SetFrameSynchronization (sync);
+}
extern void be_unlock_window (void *);
extern bool be_get_explicit_workarea (int *, int *, int *, int *);
extern void be_clear_grab_view (void);
+extern void be_set_use_frame_synchronization (void *, bool);
#ifdef __cplusplus
}
|| !FRAME_LIVE_P (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)))))
kset_default_minibuffer_frame (kb, frame);
+ /* Set whether or not frame synchronization is enabled. */
+ gui_default_parameter (f, parms, Quse_frame_synchronization, Qt,
+ NULL, NULL, RES_TYPE_BOOLEAN);
+
gui_default_parameter (f, parms, Qz_group, Qnil,
NULL, NULL, RES_TYPE_SYMBOL);
update_face_from_frame_parameter (f, Qmouse_color, arg);
}
+static void
+haiku_set_use_frame_synchronization (struct frame *f, Lisp_Object arg,
+ Lisp_Object oldval)
+{
+ be_set_use_frame_synchronization (FRAME_HAIKU_VIEW (f), !NILP (arg));
+}
+
\f
DEFUN ("haiku-set-mouse-absolute-pixel-position",
haiku_set_override_redirect,
gui_set_no_special_glyphs,
gui_set_alpha_background,
- NULL,
+ haiku_set_use_frame_synchronization,
};
void