GDK Porting + linux-fb



i all,
 
I do not know if it is the right place to ask, but here is my problem.
 
I am developing a windowing system called xynth, and wanted to port gdk on it. 
i took the linux-fb port as a skeleton  becouse my client lib has no futures 
than framebuffer (a virtual buffer, and low-level graphics functions) on 
drawing  side.
 
simply with 2-3 days work I was able to see, and use testgtk application. the 
idea is very simple, in linux-fb port of  gdk all the things drawn on 
shadowed buffer, when gdk_shadow_update called I draw the requested box to my 
clients virtual  buffer, and to the screen ofcourse. ofcourse this is working 
rather slow, but optimization will be at the very-end. 
 
i have 3 real problems right know.
1. in gdkevents-fb.c file, a loop-thread is opened i think (?) and pending 
events are being checked && maneged with  fb_events_check function. I add 
events that are coming from my server from my clients loop (by calling  
handle_mouse_movement, send_button_event etc...). And I gave a timeout=0 in 
fb_events_prepare function, so i can manage  all events with it, but becouse 
it is a while loop(?) it raises up the cpu usage (~%70). I wonder if i can 
eliminate the  _gdk_events_init function, and event_checking thread and do 
its job in somewhere else? 
 
2. when i press a close button in a gdk window, it calls 
_gdk_windowing_window_destroy recursively for any object in the   window, so
i append a few lines at the very buttom of this function;
	if (GDK_DRAWABLE_IMPL_FBDATA(window)->window_type == GDK_WINDOW_TOPLEVEL) {
			if (GDK_DRAWABLE_IMPL_FBDATA(window)->running) { /* to avoid recursing */
				s_thread_t tid;
				GDK_DRAWABLE_IMPL_FBDATA(window)->running = 0;
				tid = GDK_DRAWABLE_IMPL_FBDATA(window)->xynth_window->tid;
				s_client_quit(GDK_DRAWABLE_IMPL_FBDATA(window)->xynth_window);
				/* this sends a close event to my window */
				s_thread_join(tid, NULL); /* wait until my windows thread closes */
			}
	}
this works perfect for me, but i do not know if it the right way to do so.
And if my window gains a close event, i call gdk_window_destroy(gdk_window), 
gdk_window is the toplevel window. 
	/* my client libs at event call back */
	s_event_t *event
	if (event->type & EXPOS_EVENT) {
		...
	} else if (event->type & MOUSE_EVENT) {
		...
	} else if (event->type == QUIT_EVENT) {
		if (GDK_DRAWABLE_IMPL_FBDATA((GdkWindow *) 
window->client->user_data)->running) { /* to avaid recursing */
			GDK_DRAWABLE_IMPL_FBDATA((GdkWindow *) window->client->user_data)->running 
= 0;
			gdk_window_destroy((GdkWindow *) window->client->user_data);
		}
	}
this is working, but how  some times segfaults 1-2 seconds after i close a 
window, or after closing 5-6 windows...  something is wrong but ?

3. in linux-fb windows cant gain focus (?), how could i do that?

Thanks for any help.
 
if anyone interests, here is the screen shots for gtk porting progress;
http://gsu.linux.org.tr/~distch/projects/xynth/img/xynth_gtk_03.png
http://gsu.linux.org.tr/~distch/projects/xynth/img/?list
 
Alper.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]