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 08-25-2010, 12:01 PM   #31
dima_tr
Groupie
dima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-booksdima_tr has learned how to read e-books
 
Posts: 175
Karma: 863
Join Date: Oct 2009
Location: Germany, Karlsruhe
Device: Iliad v2, DR800S (inlove)
As we need only a partial update I'd go for [2], I doubt you can do this with [1].
Or alternatively I'd wrap the label with GtkEventBox, sysd/display.c hints this explicitly.
dima_tr is offline   Reply With Quote
Old 08-25-2010, 06:17 PM   #32
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 711
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, in love with iRex DR800S. Also a K4NT. Now a Kobo Aura
Quote:
Originally Posted by Iņigo View Post
So I will try a gtk_widget_queue_draw() in first place and if it doesn't work either, I'll try the functions from liberutils (display_utils) [1] or a direct ioctl call [2].

Btw, if any of you haven't fully read that thread is really interesting.

[1] http://www.mobileread.com/forums/sho...59&postcount=8
[2] http://www.mobileread.com/forums/sho...24&postcount=4

Ok, we will see in a few hours.
I've tried everything: gtk_widget_queue_redraw(), ioctl calls, display_update_* functions with full and partial refreshes, wrapping inside an eventbox... but nothing works.
I suppose problem comes from that device doesn't know which part to update, but I'm not sure because full refresh didn't work either...

So by now we must use CoolDragon's menu_show/menu_hide idea to refresh the clock ok, ok, it's better that not having a clock, isn't it?

Iņigo
Iņigo is offline   Reply With Quote
Old 08-25-2010, 06:35 PM   #33
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 232
Karma: 122
Join Date: Feb 2010
Device: none
I know nothing about GTK programming. The only thing that is similar to what we need seems to be the battery gauge: it will update when certain threshold is reached. Maybe there is similar trick that can be applied to the clock?

Another thought is: given the fact it actually updates when the menu bar is pressed, it is actually capable of doing a local refresh, but just ignoring some events. Is it possible to register some other events to the clock widget?
CoolDragon is offline   Reply With Quote
Old 08-25-2010, 06:54 PM   #34
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 711
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, in love with iRex DR800S. Also a K4NT. Now a Kobo Aura
OK, trying to forget the clock refresh fiasco I've just finished the changes to make notepad application to behave as the DR1000 one, that is, not to close the current note when opening another note or document.

I need to test more and clean the code. Maybe tomorrow.

My intention is to finish this and create a new binary package this weekend with the improved notepad and the clock.

Any idea, comment or suggestion?

Iņigo
Iņigo is offline   Reply With Quote
Old 08-25-2010, 07:04 PM   #35
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 711
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, in love with iRex DR800S. Also a K4NT. Now a Kobo Aura
Quote:
Originally Posted by CoolDragon View Post
I know nothing about GTK programming. The only thing that is similar to what we need seems to be the battery gauge: it will update when certain threshold is reached. Maybe there is similar trick that can be applied to the clock?

Another thought is: given the fact it actually updates when the menu bar is pressed, it is actually capable of doing a local refresh, but just ignoring some events. Is it possible to register some other events to the clock widget?
AFAIK it's not a gtk issue.
Battery uses images selecting among different icons (5?) depending on the battery level. I studied the code but it doesn't do anything special, change the image and do a gtk_widget_show() only.
I think that the image shown in screen remains static until a new full refresh is performed, showing the new image. That makes sense because battery doesn't drop from 50% to 25% in a small time frame, so any event will happen eventually.

I also thought in forcing an event like menu show/hide but didn't found anything easy to launch. We would need some esoteric arguments, such as context and some others...
Iņigo is offline   Reply With Quote
Old 08-26-2010, 02:36 AM   #36
Mackx
Guru
Mackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to behold
 
Posts: 998
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
Hi Iņigo,

I think it has to do with the idle/suspend behaviour. After 5 seconds of idle behaviour (I.e. no 'busy background' and no windows-events for 5 seconds) a suspend mode is triggered, which stops the cpu-clock (as far as I understand the code/script correctly). I assume that the cpu wakes up from this when a button is pressed, stylus is used, battery is empty, usb is connected, ... These are all 'externally' triggered events that (presumably) trigger an interrupt to wake-up the CPU (i.e. start cpu-clock). The purpose of this all is to limit power consumption. The downside is that the timers like you use them will not fire until an external event occurs.
Can you try to set the timeout to smaller then 5 seconds? That would 'confirm' my ideas on the internal workings of the firmware/hardware.
You already told that the clock is not even updated when you turn-pages, that would contradict with my idea above...

As another experiment you could show mm:ss instead of hh:mm and update every second, 2s, 5s, 10s, 30s to see if you get updates at all.
Mackx is offline   Reply With Quote
Old 08-26-2010, 10:37 AM   #37
Mackx
Guru
Mackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to beholdMackx is a splendid one to behold
 
Posts: 998
Karma: 19985
Join Date: Dec 2008
Location: Netherlands
Device: iRex DR1000S
Could this help? Found it in notepad_ipc.cpp:
Code:
    static void ipc_menu_update_toolbar(void)
    {
        eripc_send_varargs(eripcClient->context, NULL, NULL, ERIPC_BUS_SESSION,
                DBUS_SERVICE_POPUP_MENU, "updatesFinished", ERIPC_TYPE_INVALID);
    }
Mackx is offline   Reply With Quote
Old 08-26-2010, 12:19 PM   #38
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 232
Karma: 122
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by Mackx View Post
Hi Iņigo,

I think it has to do with the idle/suspend behaviour. After 5 seconds of idle behaviour (I.e. no 'busy background' and no windows-events for 5 seconds) a suspend mode is triggered, which stops the cpu-clock (as far as I understand the code/script correctly). I assume that the cpu wakes up from this when a button is pressed, stylus is used, battery is empty, usb is connected, ... These are all 'externally' triggered events that (presumably) trigger an interrupt to wake-up the CPU (i.e. start cpu-clock). The purpose of this all is to limit power consumption. The downside is that the timers like you use them will not fire until an external event occurs.
Can you try to set the timeout to smaller then 5 seconds? That would 'confirm' my ideas on the internal workings of the firmware/hardware.
You already told that the clock is not even updated when you turn-pages, that would contradict with my idea above...

As another experiment you could show mm:ss instead of hh:mm and update every second, 2s, 5s, 10s, 30s to see if you get updates at all.
I don't think the timer is "suspended". On the real device, when you press the menu button, the clock actually shows the updated time. Which means that the label actually has been updated, but the pixel is not re-drawn until the menu button "press" event occurred.
CoolDragon is offline   Reply With Quote
Old 08-26-2010, 12:22 PM   #39
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 232
Karma: 122
Join Date: Feb 2010
Device: none
Quote:
Originally Posted by Mackx View Post
Could this help? Found it in notepad_ipc.cpp:
Code:
    static void ipc_menu_update_toolbar(void)
    {
        eripc_send_varargs(eripcClient->context, NULL, NULL, ERIPC_BUS_SESSION,
                DBUS_SERVICE_POPUP_MENU, "updatesFinished", ERIPC_TYPE_INVALID);
    }
Still, works on QEMU, but not on device.
CoolDragon is offline   Reply With Quote
Old 08-26-2010, 03:17 PM   #40
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 232
Karma: 122
Join Date: Feb 2010
Device: none
A little improvement:

If I replace the code in statusbar_timeout_clock() from:
Code:
     sprintf(now_str, "<big>%2.2d:%2.2d</big>", local->tm_hour, local->tm_min);
     gtk_label_set_markup(GTK_LABEL(label), now_str);
to
Code:
     sprintf(now_str, "%2.2d:%2.2d", local->tm_hour, local->tm_min);
     gtk_button_set_label(GTK_BUTTON(g_menu_button), _(now_str));
There is a better chance that turning pages will trigger an update of the clock. I don't know why, somebody else can explain?

Also, there is something true with regard to Mackx's "suspend" theory: turning pages does NOT ALWAYS re-draw the clock if the time between page turning is long enough (like several minutes), but if you turn pages fast enough (maybe less than 5 seconds , thus disables the 5-second suspend timeout), it is very likely to re-draw the clock.

Last edited by CoolDragon; 08-26-2010 at 04:20 PM.
CoolDragon is offline   Reply With Quote
Old 08-26-2010, 04:20 PM   #41
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 711
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, in love with iRex DR800S. Also a K4NT. Now a Kobo Aura
Hi everybody,

Quote:
Originally Posted by CoolDragon View Post
Still, works on QEMU, but not on device.
Even the simple label update works on qemu. That's why I think the problem is related to the e-ink technology and refresh implementation.

Quote:
Originally Posted by CoolDragon View Post
A little improvement:

If I replace the code in statusbar_timeout_clock() from:
Code:
     sprintf(now_str, "<big>%2.2d:%2.2d</big>", local->tm_hour, local->tm_min);
     gtk_label_set_markup(GTK_LABEL(label), now_str);
to
Code:
     gtk_button_set_label(GTK_BUTTON(g_menu_button), _(now_str));
Yes, that's the easy way but It doesn't work if there is some markup in the text, as our case (the big or bold tags). That's the reason I get label first and then set the text using gtk_label_set_markup() instead of xxx_set_text().

Quote:
Originally Posted by CoolDragon View Post
There is a better chance that turning pages will trigger an update of the clock. I don't know why, somebody else can explain?

Also, there is something true with regard to Mackx's "suspend" theory: turning pages does NOT ALWAYS re-draw the clock if the time between page turning is long enough (like several minutes), but if you turn pages fast enough (maybe less than 5 seconds , thus disables the 5-second suspend timeout), it is very likely to re-draw the clock.
I think Mackx is correct in his hypothesis.
Anyway, I think I'll leave the code as it is now... perhaps waking device juts to update the clock would drain the battery. And as a simple show menu refresh the clock I don't think is so awful to live with it.

Quote:
Originally Posted by Mackx View Post
Could this help? Found it in notepad_ipc.cpp:
Code:
    static void ipc_menu_update_toolbar(void)
    {
        eripc_send_varargs(eripcClient->context, NULL, NULL, ERIPC_BUS_SESSION,
                DBUS_SERVICE_POPUP_MENU, "updatesFinished", ERIPC_TYPE_INVALID);
    }
Uhmmm... I didn't notice the eripcClient is a global variable that can be used anywhere... interesting!
Iņigo is offline   Reply With Quote
Old 08-26-2010, 04:32 PM   #42
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 232
Karma: 122
Join Date: Feb 2010
Device: none
Quote:
Yes, that's the easy way but It doesn't work if there is some markup in the text, as our case (the big or bold tags). That's the reason I get label first and then set the text using gtk_label_set_markup() instead of xxx_set_text().
I know, you cannot adjust the style of the label using the xxx_set_text(). But xxx_set_text() yields almost identical result as <big>. Anyway, I would like to know how to set the font of the label to some "fixed width" font, because, when the clock updates between full screen refresh, the label width will change a little bit, along with the status bar icons's positions. The result of a local refresh is some "ghost" pixel from previous drawing.
CoolDragon is offline   Reply With Quote
Old 08-26-2010, 04:41 PM   #43
Iņigo
Guru
Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.Iņigo did not drink the Kool Aid.
 
Posts: 711
Karma: 72743
Join Date: Feb 2008
Location: Here or there
Device: iRex iLiad, in love with iRex DR800S. Also a K4NT. Now a Kobo Aura
Quote:
Originally Posted by CoolDragon View Post
I know, you cannot adjust the style of the label using the xxx_set_text(). But xxx_set_text() yields almost identical result as <big>. Anyway, I would like to know how to set the font of the label to some "fixed width" font, because, when the clock updates between full screen refresh, the label width will change a little bit, along with the status bar icons's positions. The result of a local refresh is some "ghost" pixel from previous drawing.
The easy way is to change the /usr/share/popupmenu/popupmenu.rc "style" file. You can find some simple useful examples on the lua apps I've released.
EDIT: adding a name for the widget (gtk_widget_set_name() ?) could help to identify only this label in the style file.

Last edited by Iņigo; 08-26-2010 at 04:50 PM.
Iņigo is offline   Reply With Quote
Old 08-26-2010, 05:02 PM   #44
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 232
Karma: 122
Join Date: Feb 2010
Device: none
OK, now your markup becomes handy. Just wrap the string with <tt> and </tt>.

By the way, <big></big> seems a little bit too big, the default size (nothing specified) is the same as gtk_button_set_label()
CoolDragon is offline   Reply With Quote
Old 08-26-2010, 05:14 PM   #45
CoolDragon
Addict
CoolDragon doesn't litterCoolDragon doesn't litter
 
Posts: 232
Karma: 122
Join Date: Feb 2010
Device: none
This seems to further justify Mackx's hypothesis: on the real device, if you tap on the separator(blank space between toolbar icons and status icons), the clock will update very nicely (just the changed digits, nothing else).

So what's the easy way to trigger this event in statusbar_timeout_clock()?
CoolDragon is offline   Reply With Quote
Reply

Tags
devel, dr800+, features

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DR800 ANN: DR800+. Port of some DR1000 features to the DR800 Iņigo iRex 274 04-05-2013 02:24 PM
DR800 usbnet (USB networking to make development easier) for DR800 GregorRichards iRex 40 07-20-2011 09:38 PM
DR800 Plugin development for DR800/DR1000 yuri_b iRex Developer's Corner 0 09-18-2010 09:46 AM
DR800 parryl iRex 1 08-06-2010 03:00 PM


All times are GMT -4. The time now is 03:55 AM.


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