08-17-2009, 10:42 PM | #121 |
Connoisseur
Posts: 95
Karma: 186186
Join Date: May 2009
Location: Canberra, Australia
Device: Irex Iliad (Dead), EcoReader (Smashed screen), Kobo Touch
|
Finally had a go at getting my FBReader idea to work, but I'm stuck on some c/c++ incompatibility. xEPDmgr is c, FBReader is C++.
I've done: Code:
extern "C" { #include "xepdmgrclient.h" } Code:
ZLGtkViewWidget.cpp: In function `void doPaint(GtkWidget*, GdkEventExpose*, ZLGtkViewWidget*)': ZLGtkViewWidget.cpp:114: error: invalid conversion from `int' to `sEpd*' ZLGtkViewWidget.cpp:114: error: initializing argument 1 of `int EpdRefreshAuto(sEpd*, int)' ZLGtkViewWidget.cpp:121: error: invalid conversion from `int' to `sEpd*' ZLGtkViewWidget.cpp:121: error: initializing argument 1 of `int EpdCancel(sEpd*)' ZLGtkViewWidget.cpp:122: error: invalid conversion from `int' to `sEpd*' ZLGtkViewWidget.cpp:122: error: initializing argument 1 of `int EpdRefreshAuto(sEpd*, int)' ZLGtkViewWidget.cpp: At global scope: ZLGtkViewWidget.cpp:320: warning: unused parameter 'track' make[2]: *** [ZLGtkViewWidget.o] Error 1 I'm a bit out of my depth here with c/c++ compatibility, anyone got a quick fix? |
08-18-2009, 07:48 AM | #122 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
I have some similiar situation when I tried to use xepdmgrclient in djview4. I included xepdmgrclient.h and xepdmgrclient.c in the source code.
Code:
[sbox-iLiad-oesdk: ~/djview4-4.5/src] > make g++ -c -pipe -I.././src -I.. -pthread -I/usr/local/include -O2 -Wall -W -D_REENTRANT -DAUTOCONF -DNDEBUG -DQT_NO_DEBUG -DQT_NO_DEBUG_STREAM -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/targets/iLiad-oesdk/usr/local/Trolltech/Qt-4.5.2/mkspecs/linux-g++ -I. -I/targets/iLiad-oesdk/usr/local/Trolltech/Qt-4.5.2/include/QtCore -I/targets/iLiad-oesdk/usr/local/Trolltech/Qt-4.5.2/include/QtNetwork -I/targets/iLiad-oesdk/usr/local/Trolltech/Qt-4.5.2/include/QtGui -I/targets/iLiad-oesdk/usr/local/Trolltech/Qt-4.5.2/include -I/usr/X11R6/include -I. -I. -o djview.o djview.cpp In file included from djview.cpp:58: xepdmgrclient.c: In function `sEpd* EpdInit(char*)': xepdmgrclient.c:43: error: invalid conversion from `void*' to `_sEpd*' xepdmgrclient.c: In function `int EpdRefreshAuto(sEpd*, int)': xepdmgrclient.c:98: error: invalid conversion from `const char*' to `char*' xepdmgrclient.c:98: error: initializing argument 2 of `int EpdLocalSend(_sEpd*, char*)' xepdmgrclient.c: In function `int EpdLocalSend(_sEpd*, char*)': xepdmgrclient.c:126: error: invalid conversion from `void*' to `char*' xepdmgrclient.c:133: error: invalid conversion from `void*' to `char*' make: *** [djview.o] Error 1 |
Advert | |
|
08-21-2009, 05:37 AM | #123 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
I think I found the solution. It's the type conversion error when calling malloc(). To solve it, add (char*) , (int*) or whatever the desired veriable type (depending on the type of parameter to be passed to sizeof()) before malloc().
|
08-21-2009, 06:45 AM | #124 |
Connoisseur
Posts: 95
Karma: 186186
Join Date: May 2009
Location: Canberra, Australia
Device: Irex Iliad (Dead), EcoReader (Smashed screen), Kobo Touch
|
that's done the trick! Almost working, now I've got FBReader turning the page in ~4s, but flashing again after another ~1s.
Getting closer! edit: Hrm, nothing I'm doing seems to get rid of the second flash, here's the code I'm using: Code:
extern "C" { #include "xepdmgrclient.c" }; sEpd *Epd; static void doPaint(GtkWidget*, GdkEventExpose*, ZLGtkViewWidget *data) { // Turn on the busy LED erIpcStartClient(ER_BUSYD_CHANNEL, &erbusyChannel); // Turn off xepdmgr auto updates EpdRefreshAuto(Epd,0); //Refresh the Display after everything has painted data->doPaint(); display = gdk_x11_display_get_xdisplay(gdk_display_get_default()); XSync(display, 1); dmDisplay(dmCmdPriorUrgent, dmQFull); // Turn xepdmgr auto updates back on EpdCancel(Epd); EpdRefreshAuto(Epd,1); //Turn off the busy LED busySetBusy(erbusyChannel, ccBusyState_Off); } Last edited by pwarren; 08-21-2009 at 07:43 AM. |
08-21-2009, 07:59 AM | #125 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
I see some problem in your code:
1. It's not necessary to call erIpcStartClient() everytime doPaint() is called. Just put erIpcStartClient() in main() should be enough. 2. I guess the flickering problem does not occur during excuting doPaint(). It should occur after doPaint() is finished, so it is useless to call xepdmgrclient api there. Maybe you should try putting those function calls in individual function in FBReaderActions.cpp, such as void ScrollingAction::run(). |
Advert | |
|
08-21-2009, 08:23 PM | #126 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Just found something interesting.
In djview4 with xepdmgr, when I flipped the page, there was always a redundant screen refreshment even after the page was properly displayed. That is, to display a page, the screen refreshes two times in a second, even though the first refreshment already does pretty well. I thought maybe I can eliminate the second refreshment by using xepdmgrclient as Antartica instructed here:https://www.mobileread.com/forums/sho...6&postcount=47. After I incorporated xepdmgrclient into djview4, the flckering effect did vanish, and left a side effect of slight ghosting. Without xepdmgrclient, there was no ghosting effect. Added: Sorry. I gave the wrong info. I did a test with modified (using xepdmgrclinet) and unmodified (using purely xepdmgr) djview4. The result is: The flickering problem only occurred in full-screen mode. And the ghost effect only occurred in window mode. It seems that neither xepdmgr or xepdmgrclient have anything to do with the ghost effect and flickering problem. Last edited by ericshliao; 08-21-2009 at 10:04 PM. |
08-22-2009, 04:53 PM | #127 |
Evangelist
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
|
Hi.
I've returned from vacations . About compiling xepdmgrclient for C++, I see that you both have work-around'd it already, but the correct use would be to compile xepdmgrclient.c with gcc and put the correct 'extern "C" {...};' in the .h, and include that .h from the c++ code. Just for completeness, I've modified slightly xepdmgrclient.h to include the extern "C" part, and compiled xepdmgrtest as a C++ app as an example. Attached is xepdmgr v1.9g (no other changes). ericshliao: for the double-refresh, the code you have shown should have avoided it. Perhaps there is a bug in xepdmgr? About the ghosting effect: the more "full refreshes" with the same image displayed you do, less ghosting; the refreshes are "full" both in window mode and in full-screen mode? |
08-22-2009, 07:12 PM | #128 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
When I flipped a page in window mode, the refreshing is "partial", because the menubar was not changed and I can see that there was no refreshing on menubar. The part that got refreshed was the area displaying document and the page number part of djview4 toolbar. In full-screen mode, the whole screen got refreshed.
Last edited by ericshliao; 08-22-2009 at 08:21 PM. |
08-22-2009, 10:39 PM | #129 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Well, the code of djview4 is quite complicated for me. Maybe I didn't disable and then enable auto-refresh at proper places. Still trying.
|
08-23-2009, 02:22 AM | #130 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
I did a small experiement by only inserting "EpdRefreshAuto(Epd,0);" in several places and no "EpdRefreshAuto(Epd,1);" at all. Ideally, I expect it will disable all screen refreshment, but the result is quite strange: it made no difference whether inserting "EpdRefreshAuto(Epd,0);" or not.
|
08-23-2009, 04:23 AM | #131 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
I wonder if this line in xepdmgrclinet.c is correct:
Code:
return(EpdLocalSend((_sEpd *)Epd,(Enabled!=0)?"Auto(1)\n":"Auto(0)\n")); |
08-23-2009, 04:56 PM | #132 | |
Evangelist
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
|
Quote:
But what you say about not working EpdRefreshAuto(Epd,0) is worrying; as soon as I have time I will test if it really works... patience. |
|
08-23-2009, 06:32 PM | #133 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
One point that I forgot to mention:
It seems iRex SDK won't accept Code:
return(EpdLocalSend((_sEpd *)Epd,(Enabled!=0)?"Auto(1)\n":"Auto(0)\n")); Code:
xepdmgrclient.c: In function `int EpdRefreshAuto(sEpd*, int)': xepdmgrclient.c:101: error: invalid conversion from `const char*' to `char*' xepdmgrclient.c:101: error: initializing argument 2 of `int EpdLocalSend(_sEpd*, char*)' Code:
static char auto0[]="Auto(0)\n"; static char auto1[]="Auto(1)\n"; return(EpdLocalSend((_sEpd *)Epd,(Enabled!=0)?auto1:auto0)); |
08-24-2009, 08:04 AM | #134 | |
Evangelist
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
|
Quote:
Well, it isn't iRex SDK what is complaining, but it is the C++ compiler trying to compile C code. C++ is a lot more nitpicking that C in regard to automatic casts. Your workaround is OK, but it would be simpler to just declare the second argument of the declaration of EpdLocalSend as an "const char *". I'll make the code c++-safe in the next release . |
|
09-03-2009, 08:50 PM | #135 |
Connoisseur
Posts: 95
Karma: 186186
Join Date: May 2009
Location: Canberra, Australia
Device: Irex Iliad (Dead), EcoReader (Smashed screen), Kobo Touch
|
I've come up with pretty much the same fixes as ericshliao.
If I were to compile FBReader that had only used EpdRefreshAuto(Epd,0) from xepdmgr, and ran it like: ./bin/xepdmgr :0 ./bin/FBReader would I then expect that no screen refreshes would take place? Because that's not what I see happening. Having EpdRefreshAutio(Epd,0) seems to make no difference to the refresh behaviour. I guess I could have introduced bugs in the code with my c++ compatibility changes. Here's my diff for xepdmgrclient.c: Code:
pwarren@buildhost:~/fbreader-0.10.7-iliad/zlibrary/core/src/application$ diff -u /home/pwarren/iliad/xepdmgr-1.9-iliad/xepdmgrclient.c ./xepdmgrclient.c --- /home/pwarren/iliad/xepdmgr-1.9-iliad/xepdmgrclient.c 2009-04-26 07:30:26.000000000 +1000 +++ ./xepdmgrclient.c 2009-08-31 12:30:13.000000000 +1000 @@ -40,7 +40,8 @@ EpdInit(char *Display) { _sEpd *Epd; - if((Epd=malloc(sizeof(_sEpd)))==NULL) + Epd = (_sEpd *)malloc(sizeof(_sEpd)); + if((Epd==NULL)) return(NULL); /* Insufficient memory */ memset(Epd,0,sizeof(_sEpd)); if((Epd->dpy=XOpenDisplay(Display))==NULL) { @@ -95,7 +96,9 @@ int EpdRefreshAuto(sEpd *Epd,int Enabled) { - return(EpdLocalSend((_sEpd *)Epd,(Enabled!=0)?"Auto(1)\n":"Auto(0)\n")); + char *on = "Auto(1)\n"; + char *off = "Auto(0)\n"; + return(EpdLocalSend((_sEpd *)Epd,(Enabled!=0)?on:off)); } /* Implementation of local functions */ @@ -123,14 +126,16 @@ cur_id=-1; /* incorrect format or atom not read */ if(cmd==NULL || (cmd_next_id!=NULL && cur_id!=next_id)) { /* server has already read this property; overwrite the property */ - if((text=malloc(2+strlen(NewCmd)+1))==NULL) + text = (char *)malloc(2+strlen(NewCmd)+1); + if(text==NULL) return(-1); text[0]=(cmd_next_id!=NULL)?next_id+'0':'?'; text[1]='\n'; strcpy(text+2,NewCmd); } else { - /* Doesn't know if the server has read this yet; append to the property */ - if((text=malloc(strlen(cmd)+strlen(NewCmd)+1))==NULL) + /* Doesn't know if the server has read this yet; append to the property */ + text=(char *)malloc(strlen(cmd)+strlen(NewCmd)+1); + if(text==NULL) return(-1); strcpy(text,cmd); strcat(text,NewCmd); |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Psychological Approach | shalini_singh | Lounge | 5 | 09-09-2009 04:33 AM |
New to Sony Reader - Best Approach | kougei | Sony Reader | 11 | 12-23-2008 10:42 PM |
iLiad xepdmgr algorithms dicussion thread | Antartica | iRex Developer's Corner | 14 | 11-17-2008 10:36 AM |
emelFM2 0.41 with xepdmgr | ericshliao | iRex | 0 | 10-06-2008 10:25 AM |
iLiad libX11.so.6, auto refresh | hansel | iRex Developer's Corner | 7 | 09-20-2008 08:40 AM |