⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pager.c

📁 安装DDD之前
💻 C
📖 第 1 页 / 共 2 页
字号:
	}    }    /* fix up the viewport indicator */    PAGER_UpdateViewPort(scr);    PAN_CheckBounds(scr);    /* do this with PanFrames too ??? HEDU */    while (XCheckTypedEvent(dpy, MotionNotify, &oevent))	MISC_StashEventTime(&oevent);    if (grab)	XUngrabServer(dpy);}/* * switch among pages */voidPAGER_SwitchPage(ScreenInfo *scr, Bool align, Bool ChangeFocus, XEvent *event){    int x, y;    unsigned int width, height;    MwmWindow *tmp_win;    Window dumwin;    if (!scr->mwm_pager)	return;    XTranslateCoordinates(dpy, event->xbutton.window, scr->pager_win,			  event->xbutton.x, event->xbutton.y, &x, &y, &dumwin);    width = scr->mwm_pager->frame_width -	2 * scr->mwm_pager->boundary_width -	2 * scr->mwm_pager->matte_width;    height = scr->mwm_pager->frame_height -	scr->mwm_pager->title_height -	2 * scr->mwm_pager->boundary_width -	2 * scr->mwm_pager->matte_width;    if (x < 0)	x = 0;    if (y < 0)	y = 0;    x = x * (scr->virt_x_max + scr->d_width) / width;    y = y * (scr->virt_y_max + scr->d_height) / height;    if (align)    {	x = (x / scr->d_width) * scr->d_width;	y = (y / scr->d_height) * scr->d_height;    }    if (x < 0)	x = 0;    if (y < 0)	y = 0;    PAGER_MoveViewPort(scr, x, y, True);    if ((ChangeFocus) &&	(Mwm.keyboard_focus_policy == XmEXPLICIT &&	 Mwm.auto_key_focus))    {	tmp_win = WIN_WindowToStruct(scr, event->xbutton.subwindow);	if (tmp_win)	{	    WIN_Raise(scr, tmp_win);	    WIN_SetFocusInTree(tmp_win);	    WIN_SetFocus(scr, tmp_win->w, tmp_win);	    MISC_SetFocusSequence(scr);	}    }}/* * creates the pager window, if needed */voidPAGER_Initialize(ScreenInfo *scr, Position x, Position y){    XTextProperty name;    int width, height, window_x, window_y;    unsigned long valuemask;    XSetWindowAttributes attributes;    width = (scr->virt_x_max + scr->d_width) / scr->virt_scale;    height = (scr->virt_y_max + scr->d_height) / scr->virt_scale;    if (x >= 0)	window_x = x;    else    {	sizehints.win_gravity = NorthEastGravity;	window_x = scr->d_width - width + x - 2;    }    if (y >= 0)	window_y = y;    else    {	window_y = scr->d_height - height + y - 2;	if (x < 0)	    sizehints.win_gravity = SouthEastGravity;	else	    sizehints.win_gravity = SouthWestGravity;    }    valuemask = (CWBackPixel | CWBorderPixel | CWEventMask | CWCursor);    attributes.background_pixel = scr->components[MWM_PAGER].background;    attributes.border_pixel = scr->components[MWM_PAGER].background;    attributes.cursor = scr->cursors[DEFAULT_CURS];    attributes.event_mask = (ExposureMask | EnterWindowMask | ButtonReleaseMask |			     ButtonMotionMask);    sizehints.width = width;    sizehints.height = height;    sizehints.x = window_x;    sizehints.y = window_y;    scr->pager_win = XCreateWindow(dpy, scr->root_win, window_x, window_y, width,				   height, (unsigned int)1,				   CopyFromParent, InputOutput,				   (Visual *)CopyFromParent,				   valuemask, &attributes);    XSetWMNormalHints(dpy, scr->pager_win, &sizehints);    XStringListToTextProperty(&pager_name, 1, &name);    XSetWMName(dpy, scr->pager_win, &name);    XSetWMIconName(dpy, scr->pager_win, &name);    XSetClassHint(dpy, scr->pager_win, &classhints);    XFree((char *)name.value);    attributes.event_mask = KeyPressMask | ExposureMask;    attributes.background_pixel = scr->components[MWM_PAGER].background;    attributes.cursor = scr->cursors[DEFAULT_CURS];    scr->pager_child_win = XCreateWindow(dpy, scr->pager_win, -10, -10, 10, 10, 0,					 CopyFromParent,					 InputOutput, CopyFromParent,					 CWEventMask | CWBackPixel | CWCursor,					 &attributes);    XStoreName(dpy, scr->pager_child_win, "PagerChildWin");    XMapRaised(dpy, scr->pager_child_win);}/* * move a window via the pager */voidPAGER_Update(ScreenInfo *scr, XEvent *event){    MwmWindow *tmp_win;    unsigned int width, height;    int Xoff, Yoff, x, y, MaxW, MaxH, xl, yt, xl1, yt1;    Window target;    Bool done, finished = False;    XEvent oevent = *event;    /* I tried to implement a feature so that when windows which could be     * opaque moved in a normal move would get the full size windows moved in     * conjunction with the pager version of the window, but it seems to     * be buggy on some machines */#ifdef BROKEN_STUFF    Bool OpaqueMove = False;    int dwidth, dheight;#endif    if (!scr->mwm_pager)	return;    EnablePagerRedraw = False;    target = oevent.xbutton.subwindow;    tmp_win = WIN_WindowToStruct(scr, target);    if (tmp_win == NULL)	return;    MaxW = scr->virt_x_max + scr->d_width;    MaxH = scr->virt_y_max + scr->d_height;    width = scr->mwm_pager->frame_width -	2 * scr->mwm_pager->boundary_width -	2 * scr->mwm_pager->matte_width;    height = scr->mwm_pager->frame_height -	scr->mwm_pager->title_height -	2 * scr->mwm_pager->boundary_width -	2 * scr->mwm_pager->matte_width;    XQueryPointer(dpy, target, &JunkRoot, &JunkChild,		  &JunkX, &JunkY, &Xoff, &Yoff, &JunkMask);    XQueryPointer(dpy, scr->pager_win, &JunkRoot, &JunkChild,		  &JunkX, &JunkY, &xl, &yt, &JunkMask);    if (xl < 0)	xl = 0;    if (yt < 0)	yt = 0;    if (xl > width)	xl = width;    if (yt > height)	yt = height;    xl -= Xoff;    yt -= Yoff;    xl1 = xl;    yt1 = yt;    while (!finished)    {	/* block until there is an interesting event */	XMaskEvent(dpy, ButtonPressMask | ButtonReleaseMask | KeyPressMask |		   PointerMotionMask | ButtonMotionMask | ExposureMask |		   VisibilityChangeMask, &oevent);	MISC_StashEventTime(&oevent);	if (oevent.type == MotionNotify)	    /* discard any extra motion events before a logical release */	    while (XCheckMaskEvent(dpy, PointerMotionMask | ButtonMotionMask |				   ButtonRelease, &oevent))	    {		MISC_StashEventTime(&oevent);		if (oevent.type == ButtonRelease)		    break;	    }	done = False;	/* Handle a limited number of key press events to allow mouseless	 * operation */	if (oevent.type == KeyPress)	    MISC_KeyboardShortcut(scr, &oevent, ButtonRelease);	switch (oevent.type)	{	case ButtonPress:	case KeyPress:	    /* throw away enter and leave events until release */	    done = True;	    break;	case ButtonRelease:	    XQueryPointer(dpy, scr->pager_win, &JunkRoot, &JunkChild,			  &JunkX, &JunkY, &xl, &yt, &JunkMask);	    if (xl < 0)		xl = 0;	    if (yt < 0)		yt = 0;	    if (xl > width)		xl = width;	    if (yt > height)		yt = height;	    xl -= Xoff;	    yt -= Yoff;	    done = True;	    finished = True;	    break;	case MotionNotify:	    XQueryPointer(dpy, scr->pager_win, &JunkRoot, &JunkChild,			  &JunkX, &JunkY, &xl, &yt, &JunkMask);	    if (xl < 0)		xl = 0;	    if (yt < 0)		yt = 0;	    if (xl > width)		xl = width;	    if (yt > height)		yt = height;	    /* redraw the rubberband */	    xl -= Xoff;	    yt -= Yoff;	    done = True;	    break;	default:	    break;	}	if (!done)	{	    EVENT_Dispatch(&oevent);	}	XMoveWindow(dpy, target, xl, yt);	draw_partitions(scr);    }    x = xl * MaxW / (int)width - scr->virt_x;    y = yt * MaxH / (int)height - scr->virt_y;    PAGER_UpdateView(scr, tmp_win);    if ((xl1 != xl) || (yt1 != yt))    {	if ((tmp_win->flags & ICONIFIED))	{	    tmp_win->icon_x_loc = x;	    tmp_win->icon_xl_loc = x -		(tmp_win->icon_w_width - tmp_win->icon_p_width) / 2;	    tmp_win->icon_y_loc = y;	    XMoveWindow(dpy, tmp_win->icon_w, tmp_win->icon_xl_loc, y + tmp_win->icon_p_height);	    if (tmp_win->icon_pixmap_w != None)		XMoveWindow(dpy, tmp_win->icon_pixmap_w, x, y);	    tmp_win->flags |= ICON_MOVED;	}	else	{	    /* show the actual window */	    DEC_ConfigureDecorations(scr, tmp_win, x, y, tmp_win->frame_width, tmp_win->frame_height, False);	}    }    EnablePagerRedraw = True;    PAGER_Clear(scr);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -