mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 04:22:05 +00:00
62ac3b312e
Instead of simply aborting we now print out a warning, when a spurious GLX_BufferSwapComplete event is handled since it seems that people are coming across the problem (perhaps due to a buggy driver) and making apps crash in this situation is a bit extreme.
103 lines
3.0 KiB
C
103 lines
3.0 KiB
C
/* Clutter.
|
|
* An OpenGL based 'interactive canvas' library.
|
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
* Copyright (C) 2006-2007 OpenedHand
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include "clutter-x11.h"
|
|
#include "clutter-stage-x11.h"
|
|
#include "clutter-backend-x11.h"
|
|
#include "clutter-stage-glx.h"
|
|
#include "clutter-backend-glx.h"
|
|
#include "clutter-private.h"
|
|
|
|
#include <clutter/clutter-backend.h>
|
|
#include <clutter/clutter-stage-manager.h>
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <GL/glxext.h>
|
|
|
|
#include <glib.h>
|
|
|
|
gboolean
|
|
clutter_backend_glx_handle_event (ClutterBackendX11 *backend_x11,
|
|
XEvent *xevent)
|
|
{
|
|
#ifdef GLX_INTEL_swap_event
|
|
ClutterBackendGLX *backend_glx = CLUTTER_BACKEND_GLX (backend_x11);
|
|
ClutterStageManager *stage_manager;
|
|
GLXBufferSwapComplete *swap_complete_event;
|
|
const GSList *l;
|
|
|
|
if (xevent->type != (backend_glx->event_base + GLX_BufferSwapComplete))
|
|
return FALSE; /* Unhandled */
|
|
|
|
swap_complete_event = (GLXBufferSwapComplete *)xevent;
|
|
|
|
#if 0
|
|
{
|
|
const char *event_name;
|
|
if (swap_complete_event->event_type == GLX_EXCHANGE_COMPLETE_INTEL)
|
|
event_name = "GLX_EXCHANGE_COMPLETE";
|
|
else if (swap_complete_event->event_type == GLX_BLIT_COMPLETE_INTEL)
|
|
event_name = "GLX_BLIT_COMPLETE";
|
|
else
|
|
{
|
|
g_assert (swap_complete_event->event_type == GLX_FLIP_COMPLETE_INTEL);
|
|
event_name = "GLX_FLIP_COMPLETE";
|
|
}
|
|
|
|
g_print ("XXX: clutter_backend_glx_event_handle event = %s\n",
|
|
event_name);
|
|
}
|
|
#endif
|
|
|
|
stage_manager = clutter_stage_manager_get_default ();
|
|
|
|
for (l = clutter_stage_manager_peek_stages (stage_manager); l; l = l->next)
|
|
{
|
|
ClutterStageWindow *stage_win = _clutter_stage_get_window (l->data);
|
|
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (stage_win);
|
|
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage_win);
|
|
|
|
if (stage_x11->xwin == swap_complete_event->drawable)
|
|
{
|
|
if (G_UNLIKELY (stage_glx->pending_swaps == 0))
|
|
{
|
|
g_warning ("Spurious GLX_BufferSwapComplete event received for "
|
|
"stage drawable = 0x%08lx",
|
|
swap_complete_event->drawable);
|
|
}
|
|
else
|
|
stage_glx->pending_swaps--;
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
return TRUE;
|
|
#else
|
|
return FALSE;
|
|
#endif
|
|
}
|
|
|