fixes in fullscreen code (restore zoom lavels)

This commit is contained in:
Stefan Frederik 2022-09-04 14:16:38 +02:00
parent f022fae205
commit ecca24191e
3 changed files with 16 additions and 5 deletions

View File

@ -877,6 +877,7 @@ static int waves_callback(int event, int mx, int my, KeySym key, int button, int
/* main window callback */
/* mx and my are set to the mouse coord. relative to window */
/* winpath: set to .drw or sub windows .x1.drw, .x2.drw, ... */
int callback(const char *winpath, int event, int mx, int my, KeySym key,
int button, int aux, int state)
{
@ -1011,6 +1012,7 @@ int callback(const char *winpath, int event, int mx, int my, KeySym key,
dbg(1, "callback(): Expose\n");
break;
case ConfigureNotify:
dbg(1,"callback(): ConfigureNotify event\n");
resetwin(1, 1, 0, 0, 0);
draw();
break;

View File

@ -141,7 +141,8 @@ static int window_state (Display *disp, Window win, char *arg) {/*{{{*/
tmp1[i] = '\0';
my_snprintf(tmp_prop1, S(tmp_prop1), "_NET_WM_STATE_%s", tmp1);
prop1 = XInternAtom(disp, tmp_prop1, False);
dbg(1, "window_state(): issuing client_msg((disp, win, \"_NET_WM_STATE\", %d, %d, %d\n",
action, prop1, prop2);
return client_msg(disp, win, "_NET_WM_STATE",
action, (unsigned long)prop1, (unsigned long)prop2, 0, 0);
@ -1010,6 +1011,7 @@ int pending_events(void)
}
#endif
/* topwin: .drw (always in tabbed interface) or .x1.drw, .x2.drw ... for multiple windows */
void toggle_fullscreen(const char *topwin)
{
char fullscr[]="add,fullscreen";
@ -1020,10 +1022,12 @@ void toggle_fullscreen(const char *topwin)
unsigned int framewindow_nchildren;
int fs;
dbg(1, "toggle_fullscreen(): topwin=%s\n", topwin);
if(!strcmp(topwin, ".drw")) {
tcleval( "winfo id .");
sscanf(tclresult(), "0x%x", (unsigned int *) &topwin_id);
} else {
/* xctx->top_path is empty string for main window or .x1, .x2, ... for additional windows */
tclvareval("winfo id ", xctx->top_path, NULL);
sscanf(tclresult(), "0x%x", (unsigned int *) &topwin_id);
}
@ -1062,6 +1066,10 @@ void toggle_fullscreen(const char *topwin)
window_state(display , parent_id,fullscr);
} else {
window_state(display , parent_id,normal);
/* when switching back from fullscreen multiple ConfigureNotify events are generated.
* pending_fullzoom does not work on the last corect ConfigureNotify event,
* so wee zoom_full() again */
zoom_full(1, 0, 1, 0.97); /* draw */
}
xctx->pending_fullzoom=1;
}
@ -1783,7 +1791,6 @@ void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h)
#else
XWindowAttributes wattr;
#endif
if(has_x) {
if(w && h) {
width = w;
@ -1805,6 +1812,8 @@ void resetwin(int create_pixmap, int clear_pixmap, int force, int w, int h)
#endif
}
if(status) {
dbg(1, "resetwin(): create_pixmap=%d, clear_pixmap=%d, force=%d, width=%d, height=%d, pending_fullzoom=%d\n",
create_pixmap, clear_pixmap, force, width, height, xctx->pending_fullzoom);
/* if(wattr.map_state==IsUnmapped) return; */
xctx->areax2 = width + 2 * INT_WIDTH(xctx->lw);
xctx->areay2 = height + 2 * INT_WIDTH(xctx->lw);
@ -2349,7 +2358,7 @@ int Tcl_AppInit(Tcl_Interp *inter)
if(fs) {
tclsetvar("fullscreen", "0");
tcleval("update");
toggle_fullscreen(".");
toggle_fullscreen(".drw");
}
if(tclgetboolvar("case_insensitive")) {

View File

@ -936,9 +936,9 @@ typedef struct {
* canvas top_path
* ----------------------------
* ".drw" ""
* ".xx.drw" ".xx"
* ".x1.drw" ".x1"
*/
char *current_win_path;
char *current_win_path; /* .drw or .x1.drw, .... ; always .drw in tabbed interface */
int *fill_type; /* for every layer: 0: no fill, 1, solid fill, 2: stipple fill */
int fill_pattern;
int draw_window;