11-16-2008, 09:57 AM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Nov 2008
Device: IRex Iliad
|
Compile GTK application on Iliad. Help
I have bought my Iliad about 1 month ago. I have expereance in programming in some areas and would like to develop some utils for Iliad, that are absent or are not convinient for my opinion (language dictionary by book reading etc).
Thanks this site I did first steps (registration and updating kernel for developer) and can compile and start "text-mode" programms. But I have some problems with gtk applications. Can somebody help me with it? 1. My work platform is Windows. To compile programs under Ubuntu I use VirtualBox. 2. Kernel version in my Iliad is 2.12 3. I have downloaded toolchain (http://developer.irexnet.com/pub/iLi...091648.tar.bz2) and unpack it on Ubuntu in root directory. 4. I made makefile (see under) follow olny my expereance with correct paths. 5. I wrote simple programm test (see under) based on main.c from contentLister. I tried to write it following gtk tutorial, but it didn't work also. 6. I wrote test.sh (see under) based on run.sh from mrxvt 7. Copy test.sh, test in mrxvt directory on MMC card Results: Programm is compilable. If I use only text-mode (without GTK), it works very well. But for GTK there are some problems. I start test.sh on my Iliad, light indicator blinks and progress bar shows progress. And so on. It stays at the same state for long long time without any result. Sorry for my english. I didn't have a great practice in it. Answers in german and russian are also possible to receive Code:
# Make option BASE_DIR1 = /usr/local/arm/oe/arm-linux/include/ BASE_DIR2 = /usr/local/arm/oe/arm-linux/lib INCLUDE = -I$(BASE_DIR1)/gtk-2.0 -I$(BASE_DIR1)/glib-2.0 -I$(BASE_DIR2)/glib-2.0/include/ -I$(BASE_DIR1)/pango-1.0 -I$(BASE_DIR1)/atk-1.0 -I$(BASE_DIR2)/gtk-2.0/include/ -I$(BASE_DIR1)/libxml2 LIB = -L$(BASE_DIR2)/ -lgtk-x11-2.0 -lglib-2.0 -lgdk-x11-2.0 -lgdk_pixbuf-2.0 -lX11 -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -latk-1.0 -lgobject-2.0 -lgmodule-2.0 -lgcrypt -lXrandr -lXext -lXft -lfreetype -lz -lfontconfig -lXfixes -lXcursor -lXrender -lXau -lpangoft2-1.0 -lgpg-error -lexpat -lm -lpango-1.0 -lgthread-2.0 # Modules OBJECTS = 2.o SOURCE_DIR = . OUTFILE = test #Compiler option GCC = /usr/local/arm/oe/bin/arm-linux-gcc # Make commands $(OUTFILE) : $(OBJECTS) $(GCC) $(LIB) -o $(OUTFILE) $(OBJECTS) $(OBJECTS): %.o: $(SOURCE_DIR)/%.cpp $(GCC) $(INCLUDE) -c $< -o $@ Code:
#include <gtk/gtk.h> #include <glib.h> int main(int argc, char *argv[]) { GtkWidget *window; /* init threads */ g_thread_init(NULL); gdk_threads_init(); gdk_threads_enter(); gtk_init(&argc, &argv); // create the main, top level, window window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(window), "Title"); gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER); gtk_container_set_border_width(GTK_CONTAINER(window), 0); gtk_widget_set_size_request(GTK_WIDGET(window), 768, 1024); gtk_window_set_modal(GTK_WINDOW(window), TRUE); gtk_window_set_resizable(GTK_WINDOW(window), FALSE); gtk_main(); gdk_threads_leave(); return 0; } Code:
export DISPLAY=:0 export scriptdir=`/usr/bin/dirname $0` cd $scriptdir ./test |
11-16-2008, 10:31 AM | #2 |
Addict
Posts: 325
Karma: 1725
Join Date: Dec 2007
Location: Münster, Germany
Device: iRex iLiad v2
|
I don't have great practice in GTK, but you can try this test.sh:
Code:
export DISPLAY=:0 export scriptdir=`/usr/bin/dirname $0` cd $scriptdir ./test > output.txt 2> error.txt |
Advert | |
|
11-16-2008, 10:56 AM | #3 |
Developer
Posts: 345
Karma: 3473
Join Date: Apr 2007
Location: Brooklyn, NY, USA
Device: iRex iLiad v1, Blackberry Tour, Kindle DX, iPad.
|
Hi!
Because of the slow refresh rate of the iLiad, you have to manually cause the screen to refresh using a command in the program, after the screen contents have been drawn. Alternately, you can use xepdmgr (see related threads in this forum), which should handle this for you. I recommend using xepdmgr, because we will eventually (I hope) be switching all programs to that. However, if you just want to try it out, you can also do it the original iRex way. Link to liberdm and include erdm.h, then when you want to refresh, call dmDisplay like this: dmDisplay(dmCmdPriorUrgent, dmQFull); That should do the trick. Of course, it gets more complicated than that, but that's the general idea. Hope this helps! |
11-16-2008, 12:05 PM | #4 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Xepdmgr is the easiest way to get GTK+ based program to run on iLiad.
One little suggestion on your code: Code:
gtk_widget_set_size_request(GTK_WIDGET(window), 768, 1024); Code:
gtk_window_fullscreen(GTK_WINDOW(window)); |
11-17-2008, 12:44 AM | #5 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
I have a question about screen refresh control on iLiad:
in liberdm/erdm.h, there are functions to do refrshing job Code:
// Do a full display update int dmDisplay(eDmCmdPriority prior, eDmQuality qual); // Blank display int dmDisplayEraseToWhite(eDmCmdPriority prior); Code:
void GtkMgr::drawImage(SplashBitmap * bitmap, int xSrc, int ySrc, int xDest, int yDest, int width , int height, GBool bDrawBorder, int current_screen_height) { if (bitmap) { if (width < 0) width = bitmap->getWidth(); if (height < 0) height = bitmap->getHeight(); dfb_copyImage(fb_mem, bitmap, xSrc, ySrc, xDest, yDest, width, height, current_screen_height); if (bDrawBorder) { // line XSetForeground(display, GDK_GC_XGC(gc), 0); XSetLineAttributes(display, GDK_GC_XGC(gc), 1, LineSolid, CapProjecting, JoinMiter); XDrawRectangle(display, GDK_WINDOW_XWINDOW(window->window), GDK_GC_XGC(gc), xDest, yDest, width, height); } } } Last edited by ericshliao; 11-17-2008 at 05:28 AM. |
Advert | |
|
11-17-2008, 01:03 AM | #6 |
Developer
Posts: 345
Karma: 3473
Join Date: Apr 2007
Location: Brooklyn, NY, USA
Device: iRex iLiad v1, Blackberry Tour, Kindle DX, iPad.
|
Ah, yes. I've seen that before... I had to deal with that when I made the fullscreen patch for ipdf.
As far as I can guess, that direct write to /dev/fb0 is basically done to speed up the page draws. I don't know how much extra speed is actually gained by doing it that way. It's kind of a pain because drawing by this method means that 1) ipdf will overwrite whatever else is on the screen; and 2) the normal gtk_window_fullscreen call was useless when I was making the ipdf fullscreen patch. Eventually I would like to see ipdf become more standardized and use fewer kludges, and this is first on my list of things to change. |
11-17-2008, 02:06 AM | #7 |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
This is a valuable info if I want to use liberdm to control screen refresh. gtk_window_fullscreen() and gtk_window_unfullscreen() do work for apps with xepdmgr.
Last edited by ericshliao; 11-17-2008 at 05:28 AM. |
11-17-2008, 02:18 AM | #8 |
Developer
Posts: 345
Karma: 3473
Join Date: Apr 2007
Location: Brooklyn, NY, USA
Device: iRex iLiad v1, Blackberry Tour, Kindle DX, iPad.
|
Yes, normal function calls should work if programs do things the conventional way. Only ipdf is weird like this, as far as I know.
I seem to recall that gtk_window_fullscreen actually was useful, because it kept the toolbars from redrawing... but I don't recall for sure, it's been a while since I worked on it. |
11-19-2008, 06:35 PM | #9 |
Junior Member
Posts: 3
Karma: 10
Join Date: Nov 2008
Device: IRex Iliad
|
Thanks all for helpfull answers. It was really a problem with screen updating. But as ussualy after answers I got new questions. I have tried two suggested methods for screen updating: 1) erdm.h and 2) xepdmgr.
1) Is there only dmDisplay method to work with screen redraw? eq. can I update self a part of screen using standard Irex approach, like radiobutton in ContentLister? I have found in source dmDisplayPartial with comment "Not implemented" and it didn't work by me. 2) Of course, it is the easiest way to migrate programs to Iliad. But if I wount control updating process (for example, restrict the redrawing for some not important things (areas, bounds etc.) or set priority of redrawing), it doesn't help. Did I understand all correct? Any way the project works without large problems instead of it is in process. |
11-25-2008, 01:49 AM | #10 | |
Guru
Posts: 976
Karma: 687
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
iLiad GTK Application Needed | Adam B. | iRex Developer's Corner | 8 | 04-04-2009 05:45 AM |
iLiad How to compile new driver for Iliad | illiad_fan | iRex Developer's Corner | 2 | 08-17-2008 05:01 AM |
iLiad [ILIAD]GTK developpement | Olivier78180 | iRex Developer's Corner | 7 | 07-14-2008 05:22 PM |
Compile application gtk+ with liberdm | Kiba | iRex | 1 | 07-05-2008 10:30 AM |
iLiad Compiling GTK apps for iliad | rudysplif | iRex Developer's Corner | 3 | 03-17-2008 12:59 PM |