Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > More E-Book Readers > iRex > iRex Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 11-01-2008, 10:50 AM   #1
renpytom
Junior Member
renpytom began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Sep 2008
Device: iliad
iLiad button support

I'm trying to port my Ren'Py visual novel engine over to the iLiad. So far, I have the port working reasonably well, with SDL displaying properly, and the screen refreshing as necessary.

However, I'm not able to get events from the hardware buttons on my iLiad. I'm able to get mouse events just fine from the stylus, but no keyboard input shows up.

I've searched around a bit, but haven't been able to find documentation on how to get the hardware buttons supported. That probably means I haven't been searching on the right thing... if someone could please point me in the right direction, I'd appreciate it.

Thanks.
renpytom is offline   Reply With Quote
Old 11-01-2008, 12:39 PM   #2
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
Quote:
Originally Posted by renpytom View Post
I'm trying to port my Ren'Py visual novel engine over to the iLiad. So far, I have the port working reasonably well, with SDL displaying properly, and the screen refreshing as necessary.

However, I'm not able to get events from the hardware buttons on my iLiad. I'm able to get mouse events just fine from the stylus, but no keyboard input shows up.

I've searched around a bit, but haven't been able to find documentation on how to get the hardware buttons supported. That probably means I haven't been searching on the right thing... if someone could please point me in the right direction, I'd appreciate it.

Thanks.
You have to make the main window of the application to have a class name of "sh", as contentlister expects that. Otherwise the button presses will not reach your application.

Don't know how to set that in SDL, tho (only know about changing the window title...). There apps for the iliad doing it properly for Gtk+, Gtk2-2.x and Qt, but AFAICT yours is the first using SDL, so it's in uncharted territory :-/.. Doing a quick check in google gives no meaningfull results, so you will probably have to set the window class in libsdl.
Antartica is offline   Reply With Quote
Old 11-02-2008, 10:27 AM   #3
renpytom
Junior Member
renpytom began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Sep 2008
Device: iliad
Okay, that did the trick, thanks!

There's several things I had to do to get SDL working on the iLiad:

- I had to patch SDL to work with the StaticGray visual.

Code:
--- src/video/x11/SDL_x11modes.c.old    2008-10-25 22:55:29.000000000 -0400
+++ src/video/x11/SDL_x11modes.c        2008-10-25 22:57:40.000000000 -0400
@@ -782,6 +782,7 @@
                         } else {
                                 add_visual(this, depth_list[i], PseudoColor);
                                 add_visual(this, depth_list[i], StaticColor);
+                                add_visual(this, depth_list[i], StaticGray);
                         }
                 }
         }
- I had to set the SDL_VIDEO_X11_WMCLASS environment variable to "sh".

- It winds up that SDL doesn't really have support for StaticGray colors. So what I wound up doing was writing a routine that converts 24 bit color to 8 bit gray. Once I do that by hand, SDL takes care of drawing it to the string.

- I have to take care of refreshing the screen myself. But that's simple... I just open a udp socket to localhost:50555, and write "!0,3,0" to it.

But programming the iLiad in pygame is now possible, with some caveats.
renpytom is offline   Reply With Quote
Old 11-04-2008, 08:22 PM   #4
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 973
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
Quote:
Originally Posted by renpytom View Post
- I had to set the SDL_VIDEO_X11_WMCLASS environment variable to "sh".

- It winds up that SDL doesn't really have support for StaticGray colors. So what I wound up doing was writing a routine that converts 24 bit color to 8 bit gray. Once I do that by hand, SDL takes care of drawing it to the string.
Hi, I have two questions.
iLiad provide 4 grayscale, why do you convert 24 bit color to 8 bit gray? I am working on a image viewer using gtk. To save memory, I wanted to load color image to grayscale, but gtk seems only support 24 bit rgb.
I don't understand Antartica's words. He said something about setting class name "sh" to make app to receive button events from contentlister. Could somebody give an explaination?
ericshliao is offline   Reply With Quote
Old 11-06-2008, 08:53 AM   #5
Antartica
Evangelist
Antartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-booksAntartica has learned how to read e-books
 
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
Quote:
Originally Posted by ericshliao View Post
Hi, I have two questions.
iLiad provide 4 grayscale, why do you convert 24 bit color to 8 bit gray? I am working on a image viewer using gtk. To save memory, I wanted to load color image to grayscale, but gtk seems only support 24 bit rgb.
The iliad X server uses the StaticGray visual, that is a 8bpp mode for grayscale displays.

The underliying framebuffer also supports that, as it's implemented as a 8bpp framebuffer.

As the screen is 4bpp (or 2bpp is using typing redraw in my experience), the least significant bits of each pixel are discarded inside the framebuffer driver, but that is off-limits for userspace applications.

So in practice, all apps have to display 8bit grayscale images (independently of how they are stored internally, be it 24bpp RGB or 4bpp gray).

I
Quote:
Originally Posted by ericshliao View Post
don't understand Antartica's words. He said something about setting class name "sh" to make app to receive button events from contentlister. Could somebody give an explaination?
When you open a window against an X server, that window has a "window class" that's independent of the window title. That class serves to identify the window to the window manager, so it can do "special" things to that window (put an icon in the icon bar, opening it in certain workspace, don't put borders, etc) if the user has configured the window manager for it. It's extensivel used in windowmaker window manager, for example.

In the iliad, that id is used to find the window that will receive hardware buttons synthetic keypresses (generated by contentlister).

try:
$ xwininfo -root
$ xwininfo -root -children
Antartica is offline   Reply With Quote
Old 11-06-2008, 11:14 AM   #6
ericshliao
Guru
ericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enoughericshliao will become famous soon enough
 
Posts: 973
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
Quote:
Originally Posted by Antartica View Post
In the iliad, that id is used to find the window that will receive hardware buttons synthetic keypresses (generated by contentlister).
Thanx for the detailed description. I have to learn more to catch up.

I still have a question about how a app respond to key pressed event from contentliester.
From ipdf source code, I copied "s_signal_connect" and "keyPressCbk" to my app, but that seems not enough. My app still not repond to PageUp and PageDown key. What part does I miss?

I still don't know how and where to:
make the main window of the application to have a class name of "sh"

Should I use gtk_window_set_wmclass()? But I don't see it in ipdf source code. How does ipdf do it?

Well, I guess the relevant code is (in GtkMgr.cpp) :
Code:
gtk_window_set_title(GTK_WINDOW(window), PACKAGE " " VERSION );
and I should replace "PACKAGE " " VERSION" to "sh"

Another question: I don't see PACKAGE " " VERSION defined in ipdf source code. Strange.


Finally, I found the solution:
http://forum.irexnet.com/viewtopic.php?t=1110
My guess is correct...partly. It seems both gtk_window_set_title and gtk_window_set_wmclass can do the right job.

Last edited by ericshliao; 11-06-2008 at 05:32 PM.
ericshliao is offline   Reply With Quote
Old 01-01-2009, 04:27 PM   #7
mac
Enthusiast
mac began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Jun 2007
Device: Iliad
Whats the matter with sound in Renpy?
mac is offline   Reply With Quote
Old 01-02-2009, 01:39 PM   #8
renpytom
Junior Member
renpytom began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Sep 2008
Device: iliad
It's currently disabled, as the slow CPU on the iLiad causes it to skip each time the page is refreshed. You can work around this by commenting out the RENPY_DISABLE_SOUND line in renpy-iliad.sh and rebuilding the package.
renpytom is offline   Reply With Quote
Old 10-14-2009, 09:55 AM   #9
mac
Enthusiast
mac began at the beginning.
 
Posts: 43
Karma: 10
Join Date: Jun 2007
Device: Iliad
It is posible to avoid the double flicker when a image it´s showed?. I have this problem with the Iliad Comic viewer (in this forum).
It is posible to compile for Iilad with the last version?.
mac is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please support my Report Bad Formatting Button petition for Kindle books! Anarel Amazon Kindle 55 01-10-2010 06:24 PM
iLiad Device Support DesiLinguist Calibre 11 08-06-2009 01:58 AM
iLiad Multiple Button support for iLiad stylus jayk iRex Developer's Corner 18 11-25-2008 01:12 PM
Thoughts on iLiad support henrikb iRex 1 09-21-2008 07:56 PM
Strange iliad problem: Button clicks don't work henrikb iRex 1 07-26-2008 05:13 PM


All times are GMT -4. The time now is 06:21 AM.


MobileRead.com is a privately owned, operated and funded community.