Author: AlbrechtS
Date: 2011-01-07 04:39:51 -0800 (Fri, 07 Jan 2011)
New Revision: 8210
Log:
src/screen_xywh.cxx:
Fix X11 screen_init() if Xinerama is available, but not active.
Still investigating why there are nonsense dpi values under Cygwin/X11,
but maybe this is an X server problem.
test/hello.cxx:
Extended test statements - don't forget to remove before release.
Modified:
branches/branch-1.3/src/screen_xywh.cxx
branches/branch-1.3/test/hello.cxx
Modified: branches/branch-1.3/src/screen_xywh.cxx
===================================================================
--- branches/branch-1.3/src/screen_xywh.cxx 2011-01-07 09:45:40 UTC (rev
8209)
+++ branches/branch-1.3/src/screen_xywh.cxx 2011-01-07 12:39:51 UTC (rev
8210)
@@ -56,7 +56,7 @@
static fl_gmi_func fl_gmi = NULL; // used to get a proc pointer for
GetMonitorInfoA
static RECT screens[16];
-static int dpi[16][2] = { { 0.0f, 0.0f } };
+static float dpi[16][2];
static BOOL CALLBACK screen_cb(HMONITOR mon, HDC, LPRECT r, LPARAM) {
if (num_screens >= 16) return TRUE;
@@ -135,14 +135,19 @@
if (XineramaIsActive(fl_display)) {
screens = XineramaQueryScreens(fl_display, &num_screens);
- } else num_screens = 1;
-
- int i;
- for (i=0; i<num_screens; i++) {
- int mm = DisplayWidthMM(fl_display, i);
- dpi[i][0] = mm ? screens[i].width*25.4f/mm : 0.0f;
+ int i;
+ for (i=0; i<num_screens; i++) {
+ int mm = DisplayWidthMM(fl_display, i);
+ dpi[i][0] = mm ? screens[i].width*25.4f/mm : 0.0f;
+ mm = DisplayHeightMM(fl_display, fl_screen);
+ dpi[i][1] = mm ? screens[i].height*25.4f/mm : dpi[i][0];
+ }
+ } else { // ! XineramaIsActive()
+ num_screens = 1;
+ int mm = DisplayWidthMM(fl_display, fl_screen);
+ dpi[0][0] = mm ? Fl::w()*25.4f/mm : 0.0f;
mm = DisplayHeightMM(fl_display, fl_screen);
- dpi[i][1] = mm ? screens[i].height*25.4f/mm : dpi[i][0];
+ dpi[0][1] = mm ? Fl::h()*25.4f/mm : dpi[0][0];
}
}
#else
Modified: branches/branch-1.3/test/hello.cxx
===================================================================
--- branches/branch-1.3/test/hello.cxx 2011-01-07 09:45:40 UTC (rev 8209)
+++ branches/branch-1.3/test/hello.cxx 2011-01-07 12:39:51 UTC (rev 8210)
@@ -30,9 +30,17 @@
#include <FL/Fl_Box.H>
int main(int argc, char **argv) {
- float h, v;
- Fl::screen_dpi(h, v);
- printf("Screen res is %g x %g ppi\n", h, v);
+#if (1) // FIXME: test screen dimensions and resolution. Remove before release
!
+ float ppi_h, ppi_v;
+ int x,y,w,h;
+ int n = Fl::screen_count();
+ for (int i=0; i<n; i++) {
+ Fl::screen_xywh(x,y,w,h,i);
+ Fl::screen_dpi(ppi_h, ppi_v, i);
+ printf("Screen %2d (%4d,%4d,%4d,%4d) res. is %7.3f x %7.3f ppi\n", i,
x,y,w,h, ppi_h, ppi_v);
+ }
+ fflush(stdout);
+#endif // FIXME: test screen dimensions and resolution. Remove before release !
Fl_Window *window = new Fl_Window(340,180);
Fl_Box *box = new Fl_Box(20,40,300,100,"Hello, World!");
box->box(FL_UP_BOX);
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit