Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/ecore

Dir     : e17/libs/ecore/src/lib/ecore_fb


Modified Files:
      Tag: SPLIT
        Ecore_Fb.h ecore_fb.c 


Log Message:


ooooooops.. thats better!

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_fb/Attic/Ecore_Fb.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- Ecore_Fb.h  11 Feb 2003 06:27:09 -0000      1.1.2.1
+++ Ecore_Fb.h  12 Feb 2003 04:40:32 -0000      1.1.2.2
@@ -1,6 +1,11 @@
 #ifndef _ECORE_FB_H
 #define _ECORE_FB_H
 
+/* FIXME:
+ * add
+ * - code to qury fb size (width * height)
+ */
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -51,7 +56,8 @@
    
 void   ecore_fb_double_click_time_set(double t);
 double ecore_fb_double_click_time_get(void);
-       
+
+void   ecore_fb_size_get(int *w, int *h);   
 #ifdef __cplusplus
 }
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/ecore/src/lib/ecore_fb/Attic/ecore_fb.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- ecore_fb.c  11 Feb 2003 06:27:09 -0000      1.1.2.1
+++ ecore_fb.c  12 Feb 2003 04:40:32 -0000      1.1.2.2
@@ -12,6 +12,7 @@
 #include <sys/ioctl.h>
 #include <linux/kd.h>
 #include <linux/vt.h>
+#include <linux/fb.h>
 #include <sys/ioctl.h>
 
 typedef struct _Ecore_Fb_Ts_Event Ecore_Fb_Ts_Event;
@@ -33,6 +34,7 @@
    unsigned char z;
 };
 
+static void _ecore_fb_size_get(int *w, int *h);
 static int _ecore_fb_ts_fd_handler(Ecore_Fd_Handler *fd_handler, void *data);
 static int _ecore_fb_kbd_fd_handler(Ecore_Fd_Handler *fd_handler, void *data);
 static int _ecore_fb_ps2_fd_handler(Ecore_Fd_Handler *fd_handler, void *data);
@@ -53,6 +55,8 @@
 static int _ecore_fb_ps2_fd = 0;
 static int _ecore_fb_kbd_fd = 0;
 static int _ecore_fb_tty_fd = 0;
+static int _ecore_fb_console_w = 0;
+static int _ecore_fb_console_h = 0;
 static int _ecore_fb_ts_event_byte_count = 0;
 static int _ecore_fb_ps2_event_byte_count = 0;
 static Ecore_Fb_Ts_Event _ecore_fb_ts_event;
@@ -289,7 +293,7 @@
        ECORE_FB_EVENT_MOUSE_MOVE        = ecore_event_type_new();
 
      }
-   
+   _ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h);
    return _ecore_fb_init_count;
 }
 
@@ -354,6 +358,44 @@
    return _ecore_fb_double_click_time;
 }
 
+/**
+ * Get the current fb width and height in pixels
+ * @param w
+ * @param h
+ * 
+ * Get the current fb width and height in pixels
+ */
+void
+ecore_fb_size_get(int *w, int *h)
+{
+   if (w) *w = _ecore_fb_console_w;
+   if (h) *h = _ecore_fb_console_h;
+}
+
+static void
+_ecore_fb_size_get(int *w, int *h)
+{
+   struct fb_var_screeninfo fb_var;
+   int fb;
+   
+   fb = open("/dev/fb", O_RDWR);
+   if (fb < 0)
+     {
+       if (w) *w = 0;
+       if (h) *h = 0;
+       return;
+     }
+   if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1)
+     {
+       if (w) *w = 0;
+       if (h) *h = 0;
+       return;
+     }
+   close(fb);
+   if (w) *w = fb_var.xres;
+   if (h) *h = fb_var.yres;
+}
+
 static int
 _ecore_fb_ts_fd_handler(Ecore_Fd_Handler *fd_handler, void *data)
 {
@@ -529,8 +571,8 @@
        button = _ecore_fb_ps2_event.button & 0x7;
        if (x < 0) x = 0;
        if (y < 0) y = 0;
-       if (x >= 2560) x = 2560 - 1;
-       if (y >= 2560) y = 2560 - 1;
+       if (x >= _ecore_fb_console_w) x = _ecore_fb_console_w - 1;
+       if (y >= _ecore_fb_console_h) y = _ecore_fb_console_h - 1;
        /* add event to queue */
        /* always add a move event */
        if (1)




-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to