X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=xoptions.c;h=6993ab26ada7878a743db9bfcd76c63d68b2bab8;hb=67b3a0d7c465522feb67841c7374bf863df19357;hp=32588e8f424997e5342a738abd60ff0580ca2e68;hpb=4ca3b41e1ccb5ebfade606202c2084f8e9328978;p=xboard.git diff --git a/xoptions.c b/xoptions.c index 32588e8..6993ab2 100644 --- a/xoptions.c +++ b/xoptions.c @@ -555,10 +555,14 @@ GraphEventProc(Widget widget, caddr_t client_data, XEvent *event) sizing = ((w != graph->max || h != graph->value) && ((XExposeEvent*)event)->count >= 0); graph->max = w; graph->value = h; if(sizing && ((XExposeEvent*)event)->count > 0) { graph->max = 0; return; } // don't bother if further exposure is pending during resize - if(!graph->textValue || sizing) { - // create surfaces of new size for widget and buffer + if(!graph->textValue || sizing) { // create surfaces of new size for display widget if(graph->textValue) cairo_surface_destroy((cairo_surface_t *)graph->textValue); graph->textValue = (char*) cairo_xlib_surface_create(xDisplay, XtWindow(widget), DefaultVisual(xDisplay, 0), w, h); + } + if(sizing) { // the memory buffer was already created in GenericPopup(), + // to give drawing routines opportunity to use it befor first expose event + // (which are only processed when main gets to the event loop, so after all init!) + // so only change when size is no longer good if(graph->choice) cairo_surface_destroy((cairo_surface_t *) graph->choice); graph->choice = (char**) cairo_image_surface_create (CAIRO_FORMAT_ARGB32, w, h); } @@ -595,10 +599,9 @@ GraphEventProc(Widget widget, caddr_t client_data, XEvent *event) } void -DrawExpose (Option *opt, int x, int y, int w, int h) +GraphExpose (Option *opt, int x, int y, int w, int h) { XExposeEvent e; - opt = &mainOptions[W_BOARD]; if(!opt->handle) return; e.x = x; e.y = y; e.width = w; e.height = h; e.count = -1; e.type = Expose; // count = -1: kludge to suppress sizing GraphEventProc(opt->handle, (caddr_t) opt, (XEvent *) &e); // fake expose event @@ -997,6 +1000,7 @@ GenericPopUp (Option *option, char *title, DialogClass dlgNr, DialogClass parent XtAddEventHandler(last, ExposureMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask, False, (XtEventHandler) GraphEventProc, &option[i]); // mandatory user-supplied expose handler if(option[i].min & SAME_ROW) last = forelast, forelast = lastrow; + option[i].choice = (char**) cairo_image_surface_create (CAIRO_FORMAT_ARGB32, option[i].max, option[i].value); // image buffer break; case PopUp: // note: used only after Graph, so 'last' refers to the Graph widget option[i].handle = (void*) CreateComboPopup(last, option + i, i + 256*dlgNr, TRUE, option[i].value);