moved functions containing X calls: now only callback.c, xinit.c and draw.c contain xorg-specific function calls.
This commit is contained in:
parent
e77b72df9c
commit
364c2f1f3a
|
|
@ -211,58 +211,6 @@ void toggle_only_probes()
|
|||
draw();
|
||||
}
|
||||
|
||||
void toggle_fullscreen(const char *topwin)
|
||||
{
|
||||
char fullscr[]="add,fullscreen";
|
||||
char normal[]="remove,fullscreen";
|
||||
unsigned int topwin_id;
|
||||
Window rootwindow, parent_id;
|
||||
Window *framewin_child_ptr;
|
||||
unsigned int framewindow_nchildren;
|
||||
int fs;
|
||||
|
||||
|
||||
if(!strcmp(topwin, ".drw")) {
|
||||
tcleval( "winfo id .");
|
||||
sscanf(tclresult(), "0x%x", (unsigned int *) &topwin_id);
|
||||
} else {
|
||||
Tcl_VarEval(interp, "winfo id ", xctx->top_path, NULL);
|
||||
sscanf(tclresult(), "0x%x", (unsigned int *) &topwin_id);
|
||||
}
|
||||
|
||||
XQueryTree(display, topwin_id, &rootwindow, &parent_id, &framewin_child_ptr, &framewindow_nchildren);
|
||||
|
||||
|
||||
fs = tclgetintvar("fullscreen");
|
||||
fs = (fs+1)%2;
|
||||
if(fs==1) tclsetvar("fullscreen","1");
|
||||
else if(fs==2) tclsetvar("fullscreen","2");
|
||||
else tclsetvar("fullscreen","0");
|
||||
|
||||
dbg(1, "toggle_fullscreen(): fullscreen=%d\n", fs);
|
||||
if(fs==2) {
|
||||
Tcl_VarEval(interp, "pack forget ", xctx->top_path, ".menubar ", xctx->top_path, ".statusbar; update", NULL);
|
||||
xctx->menu_removed = 1;
|
||||
}
|
||||
if(fs !=2 && xctx->menu_removed) {
|
||||
Tcl_VarEval(interp, "pack ", xctx->top_path,
|
||||
".menubar -anchor n -side top -fill x -before ", xctx->top_path, ".drw; pack ",
|
||||
xctx->top_path, ".statusbar -after ", xctx->top_path, ".drw -anchor sw -fill x; update", NULL);
|
||||
xctx->menu_removed=0;
|
||||
}
|
||||
|
||||
|
||||
if(fs == 1) {
|
||||
window_state(display , parent_id,fullscr);
|
||||
} else if(fs == 2) {
|
||||
window_state(display , parent_id,normal);
|
||||
window_state(display , parent_id,fullscr);
|
||||
} else {
|
||||
window_state(display , parent_id,normal);
|
||||
}
|
||||
xctx->pending_fullzoom=1;
|
||||
}
|
||||
|
||||
#ifdef __unix__
|
||||
void new_window(const char *cell, int symbol)
|
||||
{
|
||||
|
|
@ -1353,7 +1301,7 @@ void calc_drawing_bbox(xRect *boundbox, int selected)
|
|||
}
|
||||
}
|
||||
|
||||
/* flags: bit0: invoke change_linewidth()/XSetLineAttributes, bit1: centered zoom */
|
||||
/* flags: bit0: invoke change_linewidth()/xsetLineattributes, bit1: centered zoom */
|
||||
void zoom_full(int dr, int sel, int flags, double shrink)
|
||||
{
|
||||
xRect boundbox;
|
||||
|
|
@ -2018,7 +1966,7 @@ void new_rect(int what)
|
|||
drawrect(xctx->rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2, 0);
|
||||
save_draw = xctx->draw_window;
|
||||
xctx->draw_window = 1;
|
||||
/* draw fill pattern even in XCopyArea mode */
|
||||
/* draw fill pattern even in xcopyarea mode */
|
||||
filledrect(xctx->rectcolor, NOW, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2);
|
||||
xctx->draw_window = save_draw;
|
||||
storeobject(-1, xctx->nl_x1,xctx->nl_y1,xctx->nl_x2,xctx->nl_y2,xRECT,xctx->rectcolor, 0, NULL);
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ void draw_selection(GC g, int interruptable)
|
|||
break;
|
||||
}
|
||||
#ifdef __unix__
|
||||
if(XPending(display) && interruptable)
|
||||
if(pending_events() && interruptable)
|
||||
{
|
||||
drawtemparc(g, END, 0.0, 0.0, 0.0, 0.0, 0.0);
|
||||
drawtemprect(g, END, 0.0, 0.0, 0.0, 0.0);
|
||||
|
|
|
|||
28
src/select.c
28
src/select.c
|
|
@ -496,8 +496,6 @@ void delete_only_rect_line_arc_poly(void)
|
|||
|
||||
void bbox(int what,double x1,double y1, double x2, double y2)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* fprintf(errfp, "bbox: what=%d\n", what); */
|
||||
switch(what)
|
||||
{
|
||||
|
|
@ -551,16 +549,7 @@ void bbox(int what,double x1,double y1, double x2, double y2)
|
|||
xctx->xrect[0].height = xctx->areah-4*INT_WIDTH(xctx->lw);
|
||||
|
||||
if(has_x) {
|
||||
XSetClipMask(display, xctx->gctiled, None); /* clipping already done in software */
|
||||
for(i=0;i<cadlayers;i++)
|
||||
{
|
||||
XSetClipMask(display, xctx->gc[i], None); /* clipping already done in software */
|
||||
XSetClipMask(display, xctx->gcstipple[i], None); /* optimization, clipping already done in software */
|
||||
}
|
||||
#if HAS_CAIRO==1
|
||||
cairo_reset_clip(xctx->cairo_ctx);
|
||||
cairo_reset_clip(xctx->cairo_save_ctx);
|
||||
#endif
|
||||
set_clip_mask(END);
|
||||
}
|
||||
xctx->sem=0;
|
||||
break;
|
||||
|
|
@ -581,21 +570,8 @@ void bbox(int what,double x1,double y1, double x2, double y2)
|
|||
xctx->xrect[0].width = xctx->bbx2-xctx->bbx1+2*INT_WIDTH(xctx->lw);
|
||||
xctx->xrect[0].height = xctx->bby2-xctx->bby1+2*INT_WIDTH(xctx->lw);
|
||||
if(has_x) {
|
||||
for(i=0;i<cadlayers;i++)
|
||||
{
|
||||
XSetClipRectangles(display, xctx->gc[i], 0,0, xctx->xrect, 1, Unsorted);
|
||||
XSetClipRectangles(display, xctx->gcstipple[i], 0,0, xctx->xrect, 1, Unsorted);
|
||||
}
|
||||
XSetClipRectangles(display, xctx->gctiled, 0,0, xctx->xrect, 1, Unsorted);
|
||||
set_clip_mask(SET);
|
||||
dbg(1, "bbox(): bbox= %d %d %d %d\n",xctx->areax1,xctx->areay1,xctx->areax2,xctx->areay2);
|
||||
#if HAS_CAIRO==1
|
||||
cairo_rectangle(xctx->cairo_ctx, xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height);
|
||||
cairo_clip(xctx->cairo_ctx);
|
||||
cairo_rectangle(xctx->cairo_save_ctx, xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height);
|
||||
cairo_clip(xctx->cairo_save_ctx);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
84
src/xinit.c
84
src/xinit.c
|
|
@ -736,6 +736,90 @@ int build_colors(double dim, double dim_bg)
|
|||
return 0; /* success */
|
||||
}
|
||||
|
||||
void set_clip_mask(int what)
|
||||
{
|
||||
int i;
|
||||
if(what == SET) {
|
||||
for(i=0;i<cadlayers;i++)
|
||||
{
|
||||
XSetClipRectangles(display, xctx->gc[i], 0,0, xctx->xrect, 1, Unsorted);
|
||||
XSetClipRectangles(display, xctx->gcstipple[i], 0,0, xctx->xrect, 1, Unsorted);
|
||||
}
|
||||
XSetClipRectangles(display, xctx->gctiled, 0,0, xctx->xrect, 1, Unsorted);
|
||||
#if HAS_CAIRO==1
|
||||
cairo_rectangle(xctx->cairo_ctx, xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height);
|
||||
cairo_clip(xctx->cairo_ctx);
|
||||
cairo_rectangle(xctx->cairo_save_ctx, xctx->xrect[0].x, xctx->xrect[0].y,
|
||||
xctx->xrect[0].width, xctx->xrect[0].height);
|
||||
cairo_clip(xctx->cairo_save_ctx);
|
||||
#endif
|
||||
} else if(what == END) {
|
||||
for(i=0;i<cadlayers;i++)
|
||||
{
|
||||
XSetClipMask(display, xctx->gc[i], None);
|
||||
XSetClipMask(display, xctx->gcstipple[i], None);
|
||||
}
|
||||
XSetClipMask(display, xctx->gctiled, None);
|
||||
#if HAS_CAIRO==1
|
||||
cairo_reset_clip(xctx->cairo_ctx);
|
||||
cairo_reset_clip(xctx->cairo_save_ctx);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* moved here to avoid Xorg-specific calls in move.c */
|
||||
int pending_events(void)
|
||||
{
|
||||
return XPending(display);
|
||||
}
|
||||
|
||||
void toggle_fullscreen(const char *topwin)
|
||||
{
|
||||
char fullscr[]="add,fullscreen";
|
||||
char normal[]="remove,fullscreen";
|
||||
unsigned int topwin_id;
|
||||
Window rootwindow, parent_id;
|
||||
Window *framewin_child_ptr;
|
||||
unsigned int framewindow_nchildren;
|
||||
int fs;
|
||||
|
||||
if(!strcmp(topwin, ".drw")) {
|
||||
tcleval( "winfo id .");
|
||||
sscanf(tclresult(), "0x%x", (unsigned int *) &topwin_id);
|
||||
} else {
|
||||
Tcl_VarEval(interp, "winfo id ", xctx->top_path, NULL);
|
||||
sscanf(tclresult(), "0x%x", (unsigned int *) &topwin_id);
|
||||
}
|
||||
XQueryTree(display, topwin_id, &rootwindow, &parent_id, &framewin_child_ptr, &framewindow_nchildren);
|
||||
fs = tclgetintvar("fullscreen");
|
||||
fs = (fs+1)%2;
|
||||
if(fs==1) tclsetvar("fullscreen","1");
|
||||
else if(fs==2) tclsetvar("fullscreen","2");
|
||||
else tclsetvar("fullscreen","0");
|
||||
|
||||
dbg(1, "toggle_fullscreen(): fullscreen=%d\n", fs);
|
||||
if(fs==2) {
|
||||
Tcl_VarEval(interp, "pack forget ", xctx->top_path, ".menubar ", xctx->top_path, ".statusbar; update", NULL);
|
||||
xctx->menu_removed = 1;
|
||||
}
|
||||
if(fs !=2 && xctx->menu_removed) {
|
||||
Tcl_VarEval(interp, "pack ", xctx->top_path,
|
||||
".menubar -anchor n -side top -fill x -before ", xctx->top_path, ".drw; pack ",
|
||||
xctx->top_path, ".statusbar -after ", xctx->top_path, ".drw -anchor sw -fill x; update", NULL);
|
||||
xctx->menu_removed=0;
|
||||
}
|
||||
if(fs == 1) {
|
||||
window_state(display , parent_id,fullscr);
|
||||
} else if(fs == 2) {
|
||||
window_state(display , parent_id,normal);
|
||||
window_state(display , parent_id,fullscr);
|
||||
} else {
|
||||
window_state(display , parent_id,normal);
|
||||
}
|
||||
xctx->pending_fullzoom=1;
|
||||
}
|
||||
|
||||
|
||||
void tclexit(ClientData s)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1227,6 +1227,8 @@ extern void toggle_only_probes();
|
|||
extern void update_symbol(const char *result, int x);
|
||||
extern void tclexit(ClientData s);
|
||||
extern int build_colors(double dim, double dim_bg); /* reparse the TCL 'colors' list and reassign colors 20171113 */
|
||||
extern void set_clip_mask(int what);
|
||||
extern int pending_events(void);
|
||||
extern void drill_hilight(int mode);
|
||||
extern void get_square(double x, double y, int *xx, int *yy);
|
||||
extern void del_wire_table(void);
|
||||
|
|
|
|||
Loading…
Reference in New Issue