int main(int argc, char **argv){ gtk_init (&argc, &argv); gtk_rc_parse_string ("style \"panel\" {" " fg[NORMAL]=\"#ffffff\"" "}" "style \"topframe\" {" " font_name = \"sans 10 bold\"" " fg[NORMAL]=\"#cccccc\"" "}" "style \"rowlabel\" {" " font_name = \"sans 13 \"" " fg[NORMAL]=\"#cccccc\"" "}" "class \"*\" style \"panel\"" "widget \"*.topframe.GtkLabel\" style \"topframe\"" "widget \"*.topframe*.rowlabel*\" style \"rowlabel\"" ); /* easiest way to inform gtk of changes and not deal with locking issues around the UI */ if(pipe(eventpipe)){ fprintf(stderr,"Unable to open event pipe:\n" " %s\n",strerror(errno)); return 1; } /* Allows event compression on the read side */ if(fcntl(eventpipe[0], F_SETFL, O_NONBLOCK)){ fprintf(stderr,"Unable to set O_NONBLOCK on event pipe:\n" " %s\n",strerror(errno)); return 1; } /* Tell glib to watch the notificaiton pipe in gtk_main() */ GIOChannel *channel = g_io_channel_unix_new (eventpipe[0]); g_io_channel_set_encoding (channel, NULL, NULL); g_io_channel_set_buffered (channel, FALSE); g_io_channel_set_close_on_unref (channel, TRUE); g_io_add_watch (channel, G_IO_IN, async_event_handle, NULL); g_io_channel_unref (channel); /* go */ make_panel(); struct sched_param sched; int policy,s; sched.sched_priority = 99; pthread_create(&io_thread_id,NULL,&io_thread,NULL); if(pthread_setschedparam(io_thread_id, SCHED_FIFO, &sched)){ fprintf(stderr,"Unable to set realtime scheduling on io thread\n"); } if(pthread_getschedparam(io_thread_id, &policy, &sched)){ fprintf(stderr,"Unable to check realtime scheduling on io thread\n"); } printf(" io thread policy=%s, priority=%d\n", (policy == SCHED_FIFO) ? "SCHED_FIFO" : (policy == SCHED_RR) ? "SCHED_RR" : (policy == SCHED_OTHER) ? "SCHED_OTHER" : "???", sched.sched_priority); sched.sched_priority = 90; if(pthread_setschedparam(pthread_self(), SCHED_FIFO, &sched)){ fprintf(stderr,"Unable to set realtime scheduling on main thread\n"); } if(pthread_getschedparam(pthread_self(), &policy, &sched)){ fprintf(stderr,"Unable to check realtime scheduling on main thread\n"); } printf(" main thread policy=%s, priority=%d\n", (policy == SCHED_FIFO) ? "SCHED_FIFO" : (policy == SCHED_RR) ? "SCHED_RR" : (policy == SCHED_OTHER) ? "SCHED_OTHER" : "???", sched.sched_priority); gtk_main(); return 0; }
Panel_Obj *new_panel(QSP_ARG_DECL const char *name,int dx,int dy) { Panel_Obj *po; po = new_panel_obj(name); if( po == NULL ){ printf("ERROR creating new panel object!?\n"); return(po); } //fprintf(stderr,"panel obj created...\n"); #ifndef BUILD_FOR_OBJC SET_PO_WIDTH(po, dx); SET_PO_HEIGHT(po, dy); // This represents where we put the panel on the screen... // for X11, place near the upper left... SET_PO_X(po, 100); SET_PO_Y(po, 100); SET_PO_FLAGS(po, 0); // why not initialize the flags for IOS too? SET_GW_TYPE( PO_GW(po), GW_PANEL); #endif /* ! BUILD_FOR_OBJC */ SET_PO_CHILDREN(po, new_ios_list() ); // In IOS, we don't need to have a distinction // between viewers and panels, we can add controls // to viewers and images to panels. So we need // to have a stripped down version of new_panel // to set up an existing viewer for getting widgets. //sprintf(ERROR_STRING,"new_panel %s calling make_panel",PO_NAME(po)); //advise(ERROR_STRING); make_panel(QSP_ARG po,dx,dy); /* Xlib calls */ #ifdef BUILD_FOR_OBJC /* these fields are part of the associated Gen_Win, * and must be set after the call to make_panel * That means we can't use the flags field to * pass the hide_back_button flag... */ // for IOS, typically we use the whole screen // BUG - for nav_panels, we need to push down to clear // the nav bar! SET_PO_X(po, 0); SET_PO_Y(po, 0); SET_PO_FLAGS(po, 0); #endif /* BUILD_FOR_OBJC */ make_scrnobj_ctx_for_panel(QSP_ARG po); // This is where we place the first object SET_PO_CURR_X(po,OBJECT_GAP); SET_PO_CURR_Y(po,OBJECT_GAP); curr_panel=po; //fprintf(stderr,"new_panel DONE\n"); return(po); }