mutter/clutter/cltr-core.c

95 lines
1.8 KiB
C
Raw Normal View History

2005-04-03 16:13:08 +00:00
#include "cltr-core.h"
#include "cltr-private.h"
int
cltr_init(int *argc, char ***argv)
{
2005-04-22 18:03:55 +00:00
#define GLX_SAMPLE_BUFFERS_ARB 100000
#define GLX_SAMPLES_ARB 100001
2005-04-03 16:13:08 +00:00
int gl_attributes[] =
{
GLX_RGBA,
GLX_DOUBLEBUFFER,
2005-04-22 18:03:55 +00:00
GLX_STENCIL_SIZE, 1,
GLX_DEPTH_SIZE, 24,
/*
GLX_SAMPLE_BUFFERS_ARB, 1,
GLX_SAMPLES_ARB, 0,
*/
/*
2005-04-03 16:13:08 +00:00
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
2005-04-22 18:03:55 +00:00
*/
2005-04-03 16:13:08 +00:00
0
};
XVisualInfo *vinfo;
2005-04-26 08:56:53 +00:00
gst_init (argc, argv);
2005-04-22 18:03:55 +00:00
if (!g_thread_supported ())
g_thread_init (NULL);
2005-05-14 10:19:39 +00:00
/* XInitThreads (); */
2005-04-03 16:13:08 +00:00
if ((CltrCntx.xdpy = XOpenDisplay(getenv("DISPLAY"))) == NULL)
{
return 0;
}
CltrCntx.xscreen = DefaultScreen(CltrCntx.xdpy);
CltrCntx.xwin_root = RootWindow(CltrCntx.xdpy, CltrCntx.xscreen);
2005-04-22 18:03:55 +00:00
CLTR_DBG("EXT : %s", glXQueryExtensionsString( CltrCntx.xdpy,
CltrCntx.xscreen));
2005-04-03 16:13:08 +00:00
if ((vinfo = glXChooseVisual(CltrCntx.xdpy,
CltrCntx.xscreen,
gl_attributes)) == NULL)
{
fprintf(stderr, "Unable to find visual\n");
return 0;
}
CltrCntx.gl_context = glXCreateContext(CltrCntx.xdpy, vinfo, 0, True);
2005-05-14 10:19:39 +00:00
pixel_set_vals(&CltrCntx.colors[CLTR_COL_BG], 0xff, 0xff, 0xff, 0xff );
pixel_set_vals(&CltrCntx.colors[CLTR_COL_BDR],0xff, 0xff, 0xff, 0xff );
pixel_set_vals(&CltrCntx.colors[CLTR_COL_FG], 0xff, 0xff, 0xff, 0xff );
2005-04-03 16:13:08 +00:00
cltr_events_init();
return 1;
}
int
cltr_display_width(void)
{
ClutterMainContext *ctx = CLTR_CONTEXT();
return DisplayWidth(ctx->xdpy, ctx->xscreen);
}
int
cltr_display_height(void)
{
ClutterMainContext *ctx = CLTR_CONTEXT();
return DisplayHeight(ctx->xdpy, ctx->xscreen);
}
2005-05-14 10:19:39 +00:00
PixbufPixel*
cltr_core_get_color(CltrNamedColor col)
{
ClutterMainContext *ctx = CLTR_CONTEXT();
return &ctx->colors[col];
}