int BC_DisplayInfo::right_border = -1;
int BC_DisplayInfo::auto_reposition_x = -1;
int BC_DisplayInfo::auto_reposition_y = -1;
+int BC_DisplayInfo::gl_max_texture_size = -1;
char BC_DisplayInfo::gl_shader_version[64] = { 0, };
BC_DisplayInfo::BC_DisplayInfo(const char *display_name, int show_error)
xinerama_screens = -1;
xinerama_info = 0;
init_window(display_name, show_error);
+#ifdef HAVE_GL
+ ncfgs = 0;
+ fb_cfgs = 0;
+ cfg = 0;
+ vis_info = 0;
+#endif
}
BC_DisplayInfo::~BC_DisplayInfo()
return 0;
}
+int BC_DisplayInfo::xinerama_big_screen()
+{
+ int screens = get_xinerama_screens();
+ int best = 0, ret = -1;
+ for( int k=screens; --k>=0; ) {
+ int w = xinerama_info[k].width, h = xinerama_info[k].height;
+ int sz = w * h;
+ if( sz > best ) {
+ ret = xinerama_info[k].screen_number;
+ best = sz;
+ }
+ }
+ return ret;
+}
+
static void get_top_coords(Display *display, Window win, int &px,int &py, int &tx,int &ty)
{
Window *pcwin = 0; unsigned int ncwin = 0;
#ifdef HAVE_GL
-int BC_DisplayInfo::gl_probe()
+int BC_DisplayInfo::gl_fb_config()
{
- int ncfgs = 0;
- XVisualInfo *vis_info = 0;
- GLXFBConfig *fb_cfgs = 0, cfg = 0;
#if 0
// find prefered config via glxinfo: mesa_hack
static int attribs[] = {
printf("%s\n", "BC_DisplayInfo::gl_fb_config failed");
cfg = 0;
}
+ return 0;
+}
+
+int BC_DisplayInfo::gl_probe(Window win)
+{
GLXContext glx_ctx = !cfg ? 0 :
glXCreateNewContext(display, cfg, GLX_RGBA_TYPE, 0, True);
- if( glx_ctx && glXMakeContextCurrent(display, None, None, glx_ctx) ) {
+ GLXWindow glx_win = !cfg ? 0 :
+ glXCreateWindow(display, cfg, win, 0);
+ if( glx_ctx && glx_win &&
+ glXMakeContextCurrent(display, glx_win, glx_win, glx_ctx) ) {
const char *shader_version = (const char *)
glGetString(GL_SHADING_LANGUAGE_VERSION);
if( shader_version )
strncpy(gl_shader_version, shader_version, sizeof(gl_shader_version));
}
+ gl_max_texture_size = 0;
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max_texture_size);
glXMakeContextCurrent(display, None, None, 0);
if( glx_ctx ) glXDestroyContext(display, glx_ctx);
+ if( glx_win ) glXDestroyWindow(display, glx_win);
if( fb_cfgs ) XFree(fb_cfgs);
if( vis_info ) XFree(vis_info);
return 0;
{
#ifdef SINGLE_THREAD
BC_Display::lock_display("BC_DisplayInfo::test_window");
+#endif
+#ifdef HAVE_GL
+ gl_fb_config();
#endif
x_out = 0;
y_out = 0;
x_out2 = 0;
y_out2 = 0;
- unsigned long mask = CWEventMask | CWWinGravity | CWBackPixel;
+ unsigned long mask = CWEventMask | CWWinGravity | CWBackPixel | CWColormap;
XSetWindowAttributes attr;
attr.event_mask = StructureNotifyMask;
attr.win_gravity = SouthEastGravity;
attr.background_pixel = BlackPixel(display, scrnum);
+ attr.colormap = XCreateColormap(display, rootwin, vis, AllocNone);
Window win = XCreateWindow(display, rootwin,
x_in, y_in, TEST_SIZE, TEST_SIZE,
0, depth, InputOutput,
// x_out,y_out, x_out1,y_out1, x_out2,y_out2);
//printf("\nx_in,y_in=%d,%d\n", x_in,y_in);
+#ifdef HAVE_GL
+ gl_probe(win);
+#endif
XDestroyWindow(display, win);
XFlush(display);
XSync(display, 0);
x_out = MAX(0, MIN(x_out, 48));
y_out = MAX(0, MIN(y_out, 48));
-#ifdef HAVE_GL
- gl_probe();
-#endif
#ifdef SINGLE_THREAD
BC_Display::unlock_display();
#endif
return bottom_border;
}
+int BC_DisplayInfo::get_gl_max_texture_size()
+{
+ init_borders();
+ return gl_max_texture_size;
+}
+
const char *BC_DisplayInfo::get_gl_shader_version()
{
init_borders();