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 09-27-2008, 05:03 AM   #1
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: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
A homebrew txt viewer and asking for help

This is a small GTK proram running on iLiad. Unpack it to anywhere and execute from contentlister.Because I haven't figured out the refresh mechanism, please wait for 5 secs after executing, then touch the "page 1" label (on the middle of bottom).

Attention: After each action, touch the page label on mid-bottom to refresh screen manually.

Users can select a text file to display on screen by touching "Folder" button. Touching "Cancel" button will close the program.

With proper font file installed, this app can display national text in UTF-8 encoding.

Souce code is included. Compile command:
Code:
gcc -o gtktextview gtktextview.c -I`pkg-config --cflags --libs gtk+-2.0`
I need help on getting automaitc screen refresh. Even though some people, such as scotty1024 and Antatica has proposed some way to refresh screen. I just don't understand. I tried to peek into source code of iPDF and found that it's too complicated for me to understand.
Any help is welcome.
Attached Files
File Type: zip gtktextview.zip (6.2 KB, 337 views)

Last edited by ericshliao; 09-27-2008 at 07:56 AM.
ericshliao is offline   Reply With Quote
Old 09-27-2008, 08:20 AM   #2
Antartica
Evangelist
Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.
 
Antartica's Avatar
 
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
Quote:
Originally Posted by ericshliao View Post
I need help on getting automaitc screen refresh. Even though some people, such as scotty1024 and Antatica has proposed some way to refresh screen. I just don't understand. I tried to peek into source code of iPDF and found that it's too complicated for me to understand.
Any help is welcome.
You can use the brand-new xepdmgr for that; IMHO it's the easiest way to date to handle updates. When I manage to get some free time for this, I'll post here a modified version of your program using xepdmgr .
Antartica is offline   Reply With Quote
Advert
Old 09-27-2008, 04:53 PM   #3
Antartica
Evangelist
Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.
 
Antartica's Avatar
 
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
Quote:
Originally Posted by ericshliao View Post
Souce code is included. Compile command:
Code:
gcc -o gtktextview gtktextview.c -I`pkg-config --cflags --libs gtk+-2.0`
I've started to look at it, but I've found something estrange. The source code doesn't match the executable. Is that intentional? (To avoid confusion?)

I mean, the executable has calls to liberipc that are missing in the code.

If it was intentional, I can try to add the needed calls. If it was unintentional, I prefer to modify the code you intend to use and not the vanilla version :-).

Anyway, a couple of things about porting apps to the iliad:

1. You have to set the window class to "sh" or your application will not receive kepresses (as they're are routed to the window class of the same name as the app registered in iRex's contentlister, and all apps launched from .sh files are "sh"). Look at one of the Gtk+2 apps ported by Adam as to how to do it.

2. To supress the blinking led after program launch you have to do a call to erbusy using liberipc, you have a example in the patch to libX11 http://projects.mobileread.com/iliad...0061203-2.diff

3. To stop the blinking led after any hardware button press, I don't know the correct way, but Adam has managed to do it right, so ask him

4. To handle the refreshes you have three ways at the moment:
4a. Explicit calls to liberdm (again, look at libX11 patch above as to how to do them)
4b. Using the patched libX11 (download the latest dillo from http://projects.mobileread.com/iliad..._iliad-0.7.zip and look at the launcher shell script and the files in the lib/ directory).
4c. Using xepdmgr and, if needed for your program, use calls to xepdmgrclient.[ch] to fine tune it's behaviour. It's as simple as launching your program using xepdmgr as a wrapper: ./xepdmgr ./gtktextview (see https://dev.mobileread.com/trac/xepdmgr/wiki and https://www.mobileread.com/forums/showthread.php?t=22215 for more information).

Hope that helps .

Last edited by Antartica; 09-27-2008 at 04:58 PM. Reason: sp
Antartica is offline   Reply With Quote
Old 09-27-2008, 06:58 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: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
As to the mismatched sourrce code, it may be that I made modifications after making a working binary package, then I found I should include source code in the package. Sorry for the inconvenience.

Anyway , the source code is still in primitive stage. I don't retain a source code match to the uploaded binary. Feel free to do anything you want.

I am trying to do something more in the source code, and I will try your suggestions later when I finish it.

Last edited by ericshliao; 09-27-2008 at 07:10 PM.
ericshliao is offline   Reply With Quote
Old 09-27-2008, 07:26 PM   #5
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: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
The attachment in this post contains matching source code and binary.
Attached Files
File Type: zip gtktextview.zip (6.1 KB, 327 views)
ericshliao is offline   Reply With Quote
Advert
Old 09-27-2008, 09:41 PM   #6
Adam B.
Addicted to Porting
Adam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the roughAdam B. is a jewel in the rough
 
Adam B.'s Avatar
 
Posts: 1,697
Karma: 7194
Join Date: Oct 2006
Location: Indianapolis, IN
Device: iRex iLiad, Nokia 770, Samsung i760
I may be able to look at the code Monday and see if I can fix it for refreshes and the busy light. It might be a good time to work with Antartica's xepdmgr.
Adam B. is offline   Reply With Quote
Old 09-28-2008, 04:01 PM   #7
hansel
JSR FFD2
hansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheesehansel can extract oil from cheese
 
hansel's Avatar
 
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
Quote:
Originally Posted by Adam B. View Post
I may be able to look at the code Monday and see if I can fix it for refreshes and the busy light. It might be a good time to work with Antartica's xepdmgr.
what about integrating the busy led stuff and the window class stuff (etc) in xepdmgr?
Code:
'xepdmgr -busy_off :0.0 myprog'

Last edited by hansel; 09-28-2008 at 04:04 PM.
hansel is offline   Reply With Quote
Old 09-28-2008, 04:04 PM   #8
nekokami
fruminous edugeek
nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.nekokami ought to be getting tired of karma fortunes by now.
 
nekokami's Avatar
 
Posts: 6,745
Karma: 551260
Join Date: Oct 2006
Location: Northeast US
Device: iPad, eBw 1150
I'm curious-- why are you porting a text viewer? Just as practice porting to the iLiad? Granted the text viewer the iLiad ships with isn't very good, but FBreader handles text files quite well.
nekokami is offline   Reply With Quote
Old 09-28-2008, 04:25 PM   #9
Antartica
Evangelist
Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.
 
Antartica's Avatar
 
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
Quote:
Originally Posted by hansel View Post
what about integrating the busy led stuff and the window class stuff (etc) in xepdmgr?
Code:
'xepdmgr -busy_off :0.0 myprog'
Hey I second that! Adam, If you make a patch to xepdmgr that does the busy led stuff, that would be awesome :-). The method I tried in the hacked libX11 failed miserably (and I attempted several before settling with one of them!).

About the window class stuff: that would mean that xepdmgr opens a window with the "sh" class name, and then it would have to redirect the keystrokes it receives to the window of the application...and it doesn't know the window to redirect it :-/.

Perhaps if there is a way to query the z-order of the windows and use the window with highest z-order (ignoring the ones of the panel, the pagebar and the soft-keyboard, of course)...

For now I think that setting the correct class in the app is a reasonable compromise, but for the future sure it's worthwhile goal :-).
Antartica 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
[old-topic]ebook-viewer: Open source, crossplatform viewer for EPUB, LIT, MOBI, etc kovidgoyal Calibre 68 05-30-2011 08:46 PM
PSP + homebrew as a mobile reader? albireo Alternative Devices 8 03-29-2011 07:40 PM
My homebrew imanga (image, cbz, cbr viewer)! ericshliao iRex 14 08-18-2009 11:50 PM
A homebrew proposal DasFool Sony Reader Dev Corner 4 07-30-2008 05:45 AM
PRS-500 Homebrew Wish List Aerlock Sony Reader Dev Corner 31 09-11-2007 08:27 PM


All times are GMT -4. The time now is 01:39 AM.


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