Skip to content

Commit 3df7a7b

Browse files
committed
Fixed cairo surfaces not being created/resized properly
1 parent e0c44b5 commit 3df7a7b

4 files changed

Lines changed: 47 additions & 6 deletions

File tree

LFSApplications/LFSApplications/src/lfsabout.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ int main(int argc, char **argv)
5656

5757
apc=new LFSTK_applicationClass();
5858

59-
apc->LFSTK_getDefaultWInit();
6059
apc->LFSTK_addWindow(NULL,BOXLABEL,"LFSAbout");
6160
wc=apc->mainWindow;
6261
wc->LFSTK_setKeepAbove(true);

LFSToolKit/ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
0.7.0
2+
Fixed cairo surfaces not being created/resized properly.
23
Fixed minor update glitch.
34
Ignore lines beginning with '#' when using LFSTK_loadVarsFromFile from prefs class.
45
Changes to structures, you must recompile all.

LFSToolKit/LFSToolKit/lfstk/LFSTKGlobals.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,13 @@ struct windowInitStruct
371371
int y=0;
372372
int w=1;
373373
int h=1;
374-
std::string appName;
375-
std::string className;
376-
std::string windowName;
374+
std::string appName="";
375+
std::string className="";
376+
std::string windowName="";
377377
bool overRide=false;
378378
bool loadVars=true;
379379
bool shutDisplayOnExit=false;
380-
Atom windowType;
380+
Atom windowType=0;
381381
bool decorated=true;
382382
int level=NORMAL;
383383
Display *display=NULL;

LFSToolKit/LFSToolKit/lfstk/LFSTKLib.cpp

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,19 +812,60 @@ unsigned long LFSTK_lib::LFSTK_getColourFromName(Display *display,Colormap cm,co
812812
* \param int width.
813813
* \param int height.
814814
*/
815+
#if 1
815816
void LFSTK_lib::LFSTK_setCairoSurface(Display *display,Window window,Visual *visual,cairo_surface_t **sfc,cairo_t **cr,int width,int height)
816817
{
817818
if((height<1) || (width<1))
818819
return;
819820

821+
if((sfc!=NULL) && (*sfc!=NULL))
822+
cairo_surface_destroy(*sfc);
823+
824+
*sfc=cairo_xlib_surface_create(display,window,visual,width,height);
825+
826+
if((cr!=NULL) && (*cr!=NULL))
827+
cairo_destroy (*cr);
828+
829+
*cr=cairo_create(*sfc);
830+
}
831+
#else
832+
void LFSTK_lib::LFSTK_setCairoSurface(Display *display,Window window,Visual *visual,cairo_surface_t **sfc,cairo_t **cr,int width,int height)
833+
{
834+
if((height<1) || (width<1))
835+
return;
836+
fprintf(stderr,"srfc=%p\n",*sfc);
837+
//if(*sfc!=NULL)
838+
// fprintf(stderr,"cw=%i ch=%i\n",cairo_xlib_surface_get_width (*sfc),cairo_xlib_surface_get_height (*sfc));
839+
840+
if((sfc!=NULL) && (*sfc!=NULL))
841+
{
842+
fprintf(stderr,"00000\n");
843+
cairo_surface_destroy (*sfc);
844+
845+
846+
//sfc=cairo_xlib_surface_create(display,window,visual,width,height);
847+
*sfc=NULL;
848+
}
849+
820850
if(*sfc==NULL)
851+
//{
821852
*sfc=cairo_xlib_surface_create(display,window,visual,width,height);
853+
// }
822854
else
823855
cairo_xlib_surface_set_size(*sfc,width,height);
824856
825-
if(*cr==NULL)
857+
//fprintf(stderr,"cw=%i ch=%i\n",cairo_xlib_surface_get_width (*sfc),cairo_xlib_surface_get_height (*sfc));
858+
859+
if((cr!=NULL) && (*cr!=NULL))
860+
{
861+
cairo_destroy (*cr);
862+
*cr=NULL;
863+
}
864+
//else
865+
if(*cr==NULL)
826866
*cr=cairo_create(*sfc);
827867
}
868+
#endif
828869

829870
/**
830871
* Get mime type of file.

0 commit comments

Comments
 (0)