grab screen make it work if initiated from additional tabs / windows
This commit is contained in:
parent
c51b4474e5
commit
5417392357
|
|
@ -1794,12 +1794,16 @@ static int grabscreen(const char *winpath, int event, int mx, int my, KeySym key
|
|||
}
|
||||
|
||||
if(grab_state == 1 && event == ButtonRelease) {
|
||||
char *top_path;
|
||||
int grab_w = 0, grab_h = 0;
|
||||
cairo_surface_t *sfc = NULL, *subsfc = NULL;
|
||||
png_to_byte_closure_t closure;
|
||||
char *encoded_data = NULL;
|
||||
size_t olength;
|
||||
char *prop = NULL;
|
||||
|
||||
top_path = xctx->top_path[0] ? xctx->top_path : ".";
|
||||
|
||||
grab_state = 0;
|
||||
first_motion = 1;
|
||||
xctx->ui_state &= ~GRABSCREEN;
|
||||
|
|
@ -1807,7 +1811,7 @@ static int grabscreen(const char *winpath, int event, int mx, int my, KeySym key
|
|||
x2 = rmx;
|
||||
y2 = rmy;
|
||||
INT_RECTORDER(x1, y1, x2, y2);
|
||||
tcleval("grab release [xschem get current_win_path]");
|
||||
tclvareval("grab release ", top_path, "drw", NULL);
|
||||
if(x2 - x1 > 10 && y2 -y1 > 10) {
|
||||
grab_w = (x2 - x1 + 1);
|
||||
grab_h = (y2 - y1 + 1);
|
||||
|
|
@ -2840,8 +2844,10 @@ int rstate; /* (reduced state, without ShiftMask) */
|
|||
}
|
||||
#if defined(__unix__) && HAS_CAIRO==1
|
||||
if(key == XK_Print) {
|
||||
char *top_path;
|
||||
top_path = xctx->top_path[0] ? xctx->top_path : ".";
|
||||
xctx->ui_state |= GRABSCREEN;
|
||||
tcleval("grab set -global [xschem get current_win_path]");
|
||||
tclvareval("grab set -global ", top_path, "drw", NULL);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1912,10 +1912,12 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
|
|||
* grab root window */
|
||||
else if(!strcmp(argv[1], "grabscreen"))
|
||||
{
|
||||
char *top_path;
|
||||
if(!xctx) {Tcl_SetResult(interp, not_avail, TCL_STATIC); return TCL_ERROR;}
|
||||
top_path = xctx->top_path[0] ? xctx->top_path : ".";
|
||||
#if defined(__unix__) && HAS_CAIRO==1
|
||||
xctx->ui_state |= GRABSCREEN;
|
||||
tcleval("grab set -global [xschem get current_win_path]");
|
||||
tclvareval("grab set -global ", top_path, "drw", NULL);
|
||||
#endif
|
||||
Tcl_ResetResult(interp);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue