2008-01-31 Rob Bradford <rob@openedhand.com>

* clutter/x11/clutter-backend-x11-private.h:
	Add missing start to comment

	* clutter/x11/clutter-backend-x11.c:
	* clutter/x11/clutter-event-x11.c:
	* clutter/x11/clutter-stage-x11.c:
	* clutter/x11/clutter-x11.h:
	Remove tabs.
This commit is contained in:
Robert Bradford 2008-01-31 11:24:11 +00:00
parent 6a8cdee27f
commit e40ba6e9b7
6 changed files with 145 additions and 134 deletions

View File

@ -1,3 +1,14 @@
2008-01-31 Rob Bradford <rob@openedhand.com>
* clutter/x11/clutter-backend-x11-private.h:
Add missing start to comment
* clutter/x11/clutter-backend-x11.c:
* clutter/x11/clutter-event-x11.c:
* clutter/x11/clutter-stage-x11.c:
* clutter/x11/clutter-x11.h:
Remove tabs.
2008-01-30 Emmanuele Bassi <ebassi@openedhand.com> 2008-01-30 Emmanuele Bassi <ebassi@openedhand.com>
* README: Add the osx flavour, and mark it experimental, * README: Add the osx flavour, and mark it experimental,

View File

@ -1,4 +1,4 @@
* An OpenGL based 'interactive canvas' library. /* An OpenGL based 'interactive canvas' library.
* Authored By Matthew Allum <mallum@openedhand.com> * Authored By Matthew Allum <mallum@openedhand.com>
* Copyright (C) 2006-2007 OpenedHand * Copyright (C) 2006-2007 OpenedHand
* *

View File

@ -327,7 +327,7 @@ clutter_backend_x11_init (ClutterBackendX11 *backend_x11)
static int static int
error_handler(Display *xdpy, error_handler(Display *xdpy,
XErrorEvent *error) XErrorEvent *error)
{ {
TrappedErrorCode = error->error_code; TrappedErrorCode = error->error_code;
return 0; return 0;
@ -488,8 +488,8 @@ clutter_x11_remove_filter (ClutterX11FilterFunc func,
if (filter->func == func && filter->data == data) if (filter->func == func && filter->data == data)
{ {
backend_singleton->event_filters = backend_singleton->event_filters =
g_slist_remove_link (backend_singleton->event_filters, this); g_slist_remove_link (backend_singleton->event_filters, this);
g_slist_free_1 (this); g_slist_free_1 (this);
g_free (filter); g_free (filter);

View File

@ -108,10 +108,10 @@ check_xpending (ClutterBackend *backend)
static gboolean static gboolean
xembed_send_message (ClutterBackendX11 *backend_x11, xembed_send_message (ClutterBackendX11 *backend_x11,
Window window, Window window,
long message, long message,
long detail, long detail,
long data1, long data1,
long data2) long data2)
{ {
XEvent ev; XEvent ev;
@ -330,8 +330,8 @@ handle_xembed_event (ClutterBackendX11 *backend_x11,
static gboolean static gboolean
event_translate (ClutterBackend *backend, event_translate (ClutterBackend *backend,
ClutterEvent *event, ClutterEvent *event,
XEvent *xevent) XEvent *xevent)
{ {
ClutterBackendX11 *backend_x11; ClutterBackendX11 *backend_x11;
ClutterStageX11 *stage_x11; ClutterStageX11 *stage_x11;
@ -356,23 +356,23 @@ event_translate (ClutterBackend *backend,
node = backend_x11->event_filters; node = backend_x11->event_filters;
while (node) while (node)
{ {
filter = node->data; filter = node->data;
switch (filter->func (xevent, event, filter->data)) switch (filter->func (xevent, event, filter->data))
{ {
case CLUTTER_X11_FILTER_CONTINUE: case CLUTTER_X11_FILTER_CONTINUE:
break; break;
case CLUTTER_X11_FILTER_TRANSLATE: case CLUTTER_X11_FILTER_TRANSLATE:
return TRUE; return TRUE;
case CLUTTER_X11_FILTER_REMOVE: case CLUTTER_X11_FILTER_REMOVE:
return FALSE; return FALSE;
default: default:
break; break;
} }
node = node->next; node = node->next;
} }
} }
res = TRUE; res = TRUE;
@ -390,7 +390,7 @@ event_translate (ClutterBackend *backend,
if (xevent->xconfigure.width != stage_width || if (xevent->xconfigure.width != stage_width ||
xevent->xconfigure.height != stage_height) xevent->xconfigure.height != stage_height)
{ {
clutter_actor_set_size (CLUTTER_ACTOR (stage), clutter_actor_set_size (CLUTTER_ACTOR (stage),
xevent->xconfigure.width, xevent->xconfigure.width,
xevent->xconfigure.height); xevent->xconfigure.height);
} }
@ -426,16 +426,16 @@ event_translate (ClutterBackend *backend,
{ {
if (atoms[i] == backend_x11->atom_NET_WM_STATE_FULLSCREEN) if (atoms[i] == backend_x11->atom_NET_WM_STATE_FULLSCREEN)
fullscreen_set = TRUE; fullscreen_set = TRUE;
} }
is_fullscreen = is_fullscreen =
(stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN); (stage_x11->state & CLUTTER_STAGE_STATE_FULLSCREEN);
if (fullscreen_set != is_fullscreen) if (fullscreen_set != is_fullscreen)
{ {
if (fullscreen_set) if (fullscreen_set)
stage_x11->state |= CLUTTER_STAGE_STATE_FULLSCREEN; stage_x11->state |= CLUTTER_STAGE_STATE_FULLSCREEN;
else else
stage_x11->state &= ~CLUTTER_STAGE_STATE_FULLSCREEN; stage_x11->state &= ~CLUTTER_STAGE_STATE_FULLSCREEN;
event->type = CLUTTER_STAGE_STATE; event->type = CLUTTER_STAGE_STATE;
@ -447,8 +447,8 @@ event_translate (ClutterBackend *backend,
res = FALSE; res = FALSE;
XFree (data); XFree (data);
} }
else else
res = FALSE; res = FALSE;
} }
break; break;
@ -465,29 +465,29 @@ event_translate (ClutterBackend *backend,
case FocusIn: case FocusIn:
if (!(stage_x11->state & CLUTTER_STAGE_STATE_ACTIVATED)) if (!(stage_x11->state & CLUTTER_STAGE_STATE_ACTIVATED))
{ {
/* TODO: check xevent->xfocus.detail ? */ /* TODO: check xevent->xfocus.detail ? */
stage_x11->state |= CLUTTER_STAGE_STATE_ACTIVATED; stage_x11->state |= CLUTTER_STAGE_STATE_ACTIVATED;
event->type = CLUTTER_STAGE_STATE; event->type = CLUTTER_STAGE_STATE;
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED; event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
event->stage_state.new_state = stage_x11->state; event->stage_state.new_state = stage_x11->state;
} }
else else
res = FALSE; res = FALSE;
break; break;
case FocusOut: case FocusOut:
if (stage_x11->state & CLUTTER_STAGE_STATE_ACTIVATED) if (stage_x11->state & CLUTTER_STAGE_STATE_ACTIVATED)
{ {
stage_x11->state &= ~CLUTTER_STAGE_STATE_ACTIVATED; stage_x11->state &= ~CLUTTER_STAGE_STATE_ACTIVATED;
event->type = CLUTTER_STAGE_STATE; event->type = CLUTTER_STAGE_STATE;
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED; event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
event->stage_state.new_state = stage_x11->state; event->stage_state.new_state = stage_x11->state;
} }
else else
res = FALSE; res = FALSE;
break; break;
case Expose: case Expose:

View File

@ -53,9 +53,9 @@ G_DEFINE_TYPE (ClutterStageX11, clutter_stage_x11, CLUTTER_TYPE_STAGE);
static void static void
send_wmspec_change_state (ClutterBackendX11 *backend_x11, send_wmspec_change_state (ClutterBackendX11 *backend_x11,
Window window, Window window,
Atom state, Atom state,
gboolean add) gboolean add)
{ {
XClientMessageEvent xclient; XClientMessageEvent xclient;
@ -73,8 +73,8 @@ send_wmspec_change_state (ClutterBackendX11 *backend_x11,
xclient.data.l[4] = 0; xclient.data.l[4] = 0;
XSendEvent (backend_x11->xdpy, XSendEvent (backend_x11->xdpy,
DefaultRootWindow(backend_x11->xdpy), DefaultRootWindow(backend_x11->xdpy),
False, False,
SubstructureRedirectMask|SubstructureNotifyMask, SubstructureRedirectMask|SubstructureNotifyMask,
(XEvent *)&xclient); (XEvent *)&xclient);
} }
@ -93,13 +93,13 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11)
size_hints = XAllocSizeHints(); size_hints = XAllocSizeHints();
if (!resize) if (!resize)
{ {
size_hints->max_width = size_hints->min_width = size_hints->max_width = size_hints->min_width =
stage_x11->xwin_width; stage_x11->xwin_width;
size_hints->max_height = size_hints->min_height = size_hints->max_height = size_hints->min_height =
stage_x11->xwin_height; stage_x11->xwin_height;
size_hints->flags = PMinSize|PMaxSize; size_hints->flags = PMinSize|PMaxSize;
} }
XSetWMNormalHints (stage_x11->xdpy, stage_x11->xwin, size_hints); XSetWMNormalHints (stage_x11->xdpy, stage_x11->xwin, size_hints);
@ -154,7 +154,7 @@ clutter_stage_x11_set_wm_protocols (ClutterStageX11 *stage_x11)
static void static void
clutter_stage_x11_query_coords (ClutterActor *self, clutter_stage_x11_query_coords (ClutterActor *self,
ClutterActorBox *box) ClutterActorBox *box)
{ {
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self);
@ -165,7 +165,7 @@ clutter_stage_x11_query_coords (ClutterActor *self,
static void static void
clutter_stage_x11_request_coords (ClutterActor *self, clutter_stage_x11_request_coords (ClutterActor *self,
ClutterActorBox *box) ClutterActorBox *box)
{ {
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self);
gint new_width, new_height; gint new_width, new_height;
@ -180,30 +180,30 @@ clutter_stage_x11_request_coords (ClutterActor *self,
stage_x11->xwin_height = new_height; stage_x11->xwin_height = new_height;
if (stage_x11->xwin != None) if (stage_x11->xwin != None)
{ {
XResizeWindow (stage_x11->xdpy, XResizeWindow (stage_x11->xdpy,
stage_x11->xwin, stage_x11->xwin,
stage_x11->xwin_width, stage_x11->xwin_width,
stage_x11->xwin_height); stage_x11->xwin_height);
clutter_stage_x11_fix_window_size (stage_x11); clutter_stage_x11_fix_window_size (stage_x11);
} }
if (stage_x11->xpixmap != None) if (stage_x11->xpixmap != None)
{ {
/* Need to recreate to resize */ /* Need to recreate to resize */
clutter_actor_unrealize (self); clutter_actor_unrealize (self);
clutter_actor_realize (self); clutter_actor_realize (self);
} }
CLUTTER_SET_PRIVATE_FLAGS(self, CLUTTER_ACTOR_SYNC_MATRICES); CLUTTER_SET_PRIVATE_FLAGS(self, CLUTTER_ACTOR_SYNC_MATRICES);
} }
if (stage_x11->xwin != None) /* Do we want to bother ? */ if (stage_x11->xwin != None) /* Do we want to bother ? */
XMoveWindow (stage_x11->xdpy, XMoveWindow (stage_x11->xdpy,
stage_x11->xwin, stage_x11->xwin,
CLUTTER_UNITS_TO_INT (box->x1), CLUTTER_UNITS_TO_INT (box->x1),
CLUTTER_UNITS_TO_INT (box->y1)); CLUTTER_UNITS_TO_INT (box->y1));
} }
static void static void
@ -218,76 +218,76 @@ clutter_stage_x11_set_fullscreen (ClutterStage *stage,
if (fullscreen) if (fullscreen)
{ {
if (stage_x11->xwin != None) if (stage_x11->xwin != None)
{ {
/* if the actor is not mapped we resize the stage window to match /* if the actor is not mapped we resize the stage window to match
* the size of the screen; this is useful for e.g. EGLX to avoid * the size of the screen; this is useful for e.g. EGLX to avoid
* a resize when calling clutter_stage_fullscreen() before showing * a resize when calling clutter_stage_fullscreen() before showing
* the stage * the stage
*/ */
if (!CLUTTER_ACTOR_IS_MAPPED (stage_x11)) if (!CLUTTER_ACTOR_IS_MAPPED (stage_x11))
{ {
gint width, height; gint width, height;
width = DisplayWidth (stage_x11->xdpy, stage_x11->xscreen); width = DisplayWidth (stage_x11->xdpy, stage_x11->xscreen);
height = DisplayHeight (stage_x11->xdpy, stage_x11->xscreen); height = DisplayHeight (stage_x11->xdpy, stage_x11->xscreen);
clutter_actor_set_size (CLUTTER_ACTOR (stage_x11), clutter_actor_set_size (CLUTTER_ACTOR (stage_x11),
width, height); width, height);
/* FIXME: This wont work if we support more states */ /* FIXME: This wont work if we support more states */
XChangeProperty (stage_x11->xdpy, XChangeProperty (stage_x11->xdpy,
stage_x11->xwin, stage_x11->xwin,
backend_x11->atom_NET_WM_STATE, XA_ATOM, 32, backend_x11->atom_NET_WM_STATE, XA_ATOM, 32,
PropModeReplace, PropModeReplace,
(unsigned char *) &backend_x11->atom_NET_WM_STATE_FULLSCREEN, 1); (unsigned char *) &backend_x11->atom_NET_WM_STATE_FULLSCREEN, 1);
} }
else else
{ {
/* We need to set window user resize-able for metacity at /* We need to set window user resize-able for metacity at
* at least to allow the window to fullscreen *sigh* * at least to allow the window to fullscreen *sigh*
*/ */
if (clutter_stage_get_user_resizable (stage) == TRUE) if (clutter_stage_get_user_resizable (stage) == TRUE)
was_resizeable = TRUE; was_resizeable = TRUE;
else else
clutter_stage_set_user_resizable (stage, TRUE); clutter_stage_set_user_resizable (stage, TRUE);
send_wmspec_change_state(backend_x11, stage_x11->xwin, send_wmspec_change_state(backend_x11, stage_x11->xwin,
backend_x11->atom_NET_WM_STATE_FULLSCREEN, backend_x11->atom_NET_WM_STATE_FULLSCREEN,
TRUE); TRUE);
} }
stage_x11->fullscreen_on_map = TRUE; stage_x11->fullscreen_on_map = TRUE;
} }
} }
else else
{ {
if (stage_x11->xwin != None) if (stage_x11->xwin != None)
{ {
if (!CLUTTER_ACTOR_IS_MAPPED (stage_x11)) if (!CLUTTER_ACTOR_IS_MAPPED (stage_x11))
{ {
/* FIXME: This wont work if we support more states */ /* FIXME: This wont work if we support more states */
XDeleteProperty (stage_x11->xdpy, XDeleteProperty (stage_x11->xdpy,
stage_x11->xwin, stage_x11->xwin,
backend_x11->atom_NET_WM_STATE); backend_x11->atom_NET_WM_STATE);
} }
else else
{ {
clutter_stage_set_user_resizable (stage, TRUE); clutter_stage_set_user_resizable (stage, TRUE);
send_wmspec_change_state(backend_x11, send_wmspec_change_state(backend_x11,
stage_x11->xwin, stage_x11->xwin,
backend_x11->atom_NET_WM_STATE_FULLSCREEN, backend_x11->atom_NET_WM_STATE_FULLSCREEN,
FALSE); FALSE);
/* reset the windows state - this isn't fun - see above */ /* reset the windows state - this isn't fun - see above */
if (!was_resizeable) if (!was_resizeable)
clutter_stage_set_user_resizable (stage, FALSE); clutter_stage_set_user_resizable (stage, FALSE);
was_resizeable = FALSE; was_resizeable = FALSE;
} }
stage_x11->fullscreen_on_map = FALSE; stage_x11->fullscreen_on_map = FALSE;
} }
} }
CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES); CLUTTER_SET_PRIVATE_FLAGS (stage, CLUTTER_ACTOR_SYNC_MATRICES);
@ -337,7 +337,7 @@ clutter_stage_x11_set_cursor_visible (ClutterStage *stage,
static void static void
clutter_stage_x11_set_title (ClutterStage *stage, clutter_stage_x11_set_title (ClutterStage *stage,
const gchar *title) const gchar *title)
{ {
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage);
ClutterBackendX11 *backend_x11 = stage_x11->backend; ClutterBackendX11 *backend_x11 = stage_x11->backend;
@ -348,25 +348,25 @@ clutter_stage_x11_set_title (ClutterStage *stage,
if (title == NULL) if (title == NULL)
{ {
XDeleteProperty (stage_x11->xdpy, XDeleteProperty (stage_x11->xdpy,
stage_x11->xwin, stage_x11->xwin,
backend_x11->atom_NET_WM_NAME); backend_x11->atom_NET_WM_NAME);
} }
else else
{ {
XChangeProperty (stage_x11->xdpy, XChangeProperty (stage_x11->xdpy,
stage_x11->xwin, stage_x11->xwin,
backend_x11->atom_NET_WM_NAME, backend_x11->atom_NET_WM_NAME,
backend_x11->atom_UTF8_STRING, backend_x11->atom_UTF8_STRING,
8, 8,
PropModeReplace, PropModeReplace,
(unsigned char*)title, (unsigned char*)title,
(int)strlen(title)); (int)strlen(title));
} }
} }
static void static void
clutter_stage_x11_set_user_resize (ClutterStage *stage, clutter_stage_x11_set_user_resize (ClutterStage *stage,
gboolean value) gboolean value)
{ {
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (stage);

View File

@ -76,8 +76,8 @@ typedef enum {
* Since: 0.6 * Since: 0.6
*/ */
typedef ClutterX11FilterReturn (*ClutterX11FilterFunc) (XEvent *xev, typedef ClutterX11FilterReturn (*ClutterX11FilterFunc) (XEvent *xev,
ClutterEvent *cev, ClutterEvent *cev,
gpointer data); gpointer data);
void clutter_x11_trap_x_errors (void); void clutter_x11_trap_x_errors (void);
gint clutter_x11_untrap_x_errors (void); gint clutter_x11_untrap_x_errors (void);
@ -94,7 +94,7 @@ gboolean clutter_x11_set_stage_foreign (ClutterStage *stage,
void clutter_x11_add_filter (ClutterX11FilterFunc func, void clutter_x11_add_filter (ClutterX11FilterFunc func,
gpointer data); gpointer data);
void clutter_x11_remove_filter (ClutterX11FilterFunc func, void clutter_x11_remove_filter (ClutterX11FilterFunc func,
gpointer data); gpointer data);
G_END_DECLS G_END_DECLS