mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
#include "cltr-core.h"
|
|
#include "cltr-private.h"
|
|
|
|
int
|
|
cltr_init(int *argc, char ***argv)
|
|
{
|
|
int gl_attributes[] =
|
|
{
|
|
GLX_RGBA,
|
|
GLX_DOUBLEBUFFER,
|
|
GLX_RED_SIZE, 1,
|
|
GLX_GREEN_SIZE, 1,
|
|
GLX_BLUE_SIZE, 1,
|
|
0
|
|
};
|
|
|
|
XVisualInfo *vinfo;
|
|
|
|
|
|
g_thread_init (NULL);
|
|
// XInitThreads ();
|
|
|
|
if ((CltrCntx.xdpy = XOpenDisplay(getenv("DISPLAY"))) == NULL)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
CltrCntx.xscreen = DefaultScreen(CltrCntx.xdpy);
|
|
CltrCntx.xwin_root = RootWindow(CltrCntx.xdpy, CltrCntx.xscreen);
|
|
|
|
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);
|
|
|
|
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);
|
|
}
|