summaryrefslogtreecommitdiffstats
path: root/scilab
diff options
context:
space:
mode:
Diffstat (limited to 'scilab')
-rw-r--r--scilab/modules/graphics/macros/getcolor.sci7
-rw-r--r--scilab/modules/graphics/sci_gateway/c/sci_xclick.c20
2 files changed, 14 insertions, 13 deletions
diff --git a/scilab/modules/graphics/macros/getcolor.sci b/scilab/modules/graphics/macros/getcolor.sci
index a2f69d4..ccaea69 100644
--- a/scilab/modules/graphics/macros/getcolor.sci
+++ b/scilab/modules/graphics/macros/getcolor.sci
@@ -51,7 +51,12 @@ function [c] = getcolor(Title,cini)
51 end; 51 end;
52 52
53 // create the window for getcolor 53 // create the window for getcolor
54 win = max(winsid()) + 1; 54
55 win = max(winsid());
56 if isempty(win) then
57 win = 1;
58 end
59
55 scf(win); 60 scf(win);
56 61
57 sdf; 62 sdf;
diff --git a/scilab/modules/graphics/sci_gateway/c/sci_xclick.c b/scilab/modules/graphics/sci_gateway/c/sci_xclick.c
index 2c69034..18d4ddf 100644
--- a/scilab/modules/graphics/sci_gateway/c/sci_xclick.c
+++ b/scilab/modules/graphics/sci_gateway/c/sci_xclick.c
@@ -68,8 +68,8 @@ int sci_xclick(char *fname, void *pvApiCtx)
68 68
69 // Get return values 69 // Get return values
70 mouseButtonNumber = getJxclickMouseButtonNumber(); 70 mouseButtonNumber = getJxclickMouseButtonNumber();
71 pixelCoords[0] = (int) getJxclickXCoordinate(); 71 pixelCoords[0] = (int)getJxclickXCoordinate();
72 pixelCoords[1] = (int) getJxclickYCoordinate(); 72 pixelCoords[1] = (int)getJxclickYCoordinate();
73 iWindowUID = getJxclickWindowID(); 73 iWindowUID = getJxclickWindowID();
74 menuCallback = getJxclickMenuCallback(); 74 menuCallback = getJxclickMenuCallback();
75 75
@@ -99,7 +99,7 @@ int sci_xclick(char *fname, void *pvApiCtx)
99 return 1; 99 return 1;
100 } 100 }
101 101
102 rep[0] = (double) mouseButtonNumber; 102 rep[0] = (double)mouseButtonNumber;
103 rep[1] = userCoords2D[0]; 103 rep[1] = userCoords2D[0];
104 rep[2] = userCoords2D[1]; 104 rep[2] = userCoords2D[1];
105 } 105 }
@@ -116,7 +116,7 @@ int sci_xclick(char *fname, void *pvApiCtx)
116 return 1; 116 return 1;
117 } 117 }
118 118
119 rep[0] = (double) mouseButtonNumber; 119 rep[0] = (double)mouseButtonNumber;
120 } 120 }
121 121
122 if (nbOutputArgument(pvApiCtx) >= 2) 122 if (nbOutputArgument(pvApiCtx) >= 2)
@@ -165,23 +165,19 @@ int sci_xclick(char *fname, void *pvApiCtx)
165 } 165 }
166 166
167 getGraphicObjectProperty(iWindowUID, __GO_ID__, jni_int, (void**)&piFigureId); 167 getGraphicObjectProperty(iWindowUID, __GO_ID__, jni_int, (void**)&piFigureId);
168 rep[0] = (double) iFigureId; 168 rep[0] = (double)iFigureId;
169 } 169 }
170 170
171 if (nbOutputArgument(pvApiCtx) >= 5) 171 if (nbOutputArgument(pvApiCtx) >= 5)
172 { 172 {
173 char *strRep = NULL; 173 if (createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 5, menuCallback))
174 AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5;
175 istr = (int)strlen(menuCallback);
176
177 if (allocSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + 5, istr * one, &strRep))
178 { 174 {
179 Scierror(999, _("%s: Memory allocation error.\n"), fname); 175 Scierror(999, _("%s: Memory allocation error.\n"), fname);
180 deleteJxclickString(menuCallback); 176 deleteJxclickString(menuCallback);
181 return 1; 177 return 1;
182 } 178 }
183 strncpy(strRep, menuCallback, istr); 179
184 freeAllocatedSingleString(strRep); 180 AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5;
185 } 181 }
186 182
187 deleteJxclickString(menuCallback); 183 deleteJxclickString(menuCallback);