Сообщение от ffinder
на линухе кури мануал про xlib
|
Опередил
Сообщение от xmarat
Эмм... А нет другого способа определить, а то я на Linux'е. Blitzmax не захотел это компилировать...
|
SuperStrict
Import "-lXrandr"
Import "screen.cpp"
Extern
Function GetScreenSize:Int(width:Int Var,height:Int Var)
EndExtern
Local desktopWidth:Int
Local desktopHeight:Int
Local error:Int = GetScreenSize(width, height)
И собственно сишный сорс:
screen.cpp
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<X11/Xlib.h>
#include<X11/extensions/Xrandr.h>
extern "C" int GetScreenSize(int&,int&); // Makes the function visable to other files
int GetScreenSize(int& width, int& height)
{
int num_sizes;
Rotation original_rotation;
Display *dpy = XOpenDisplay(NULL);
Window root = RootWindow(dpy, 0);
XRRScreenSize *xrrs = XRRSizes(dpy, 0, &num_sizes);
//
// GET CURRENT RESOLUTION AND FREQUENCY
//
XRRScreenConfiguration *conf = XRRGetScreenInfo(dpy, root);
short original_rate = XRRConfigCurrentRate(conf);
SizeID original_size_id = XRRConfigCurrentConfiguration(conf, &original_rotation);
width = xrrs[original_size_id].width;
height = xrrs[original_size_id].height;
XCloseDisplay(dpy);
return 0;
}