1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

removed broken optiomized selection frame patch

added Select Window button to attribute panel
This commit is contained in:
kojima
1999-11-05 23:23:48 +00:00
parent 7347ef3a2f
commit a1e552d988
8 changed files with 297 additions and 281 deletions

View File

@@ -594,8 +594,8 @@ Initialize(WMScreen *scr)
InitMouseSettings(scr, WPrefs.win);
InitAppearance(scr, WPrefs.win);
#ifdef not_yet_fully_implemented
#ifdef not_yet_fully_implemented
InitText(scr, WPrefs.win);
InitThemes(scr, WPrefs.win);
#endif

View File

@@ -127,7 +127,8 @@ typedef enum {
#define WCUR_ARROW 4
#define WCUR_QUESTION 5
#define WCUR_TEXT 6
#define WCUR_LAST 7
#define WCUR_SELECT 7
#define WCUR_LAST 8
/* geometry displays */
@@ -277,11 +278,11 @@ typedef struct WPreferences {
RImage *button_images; /* titlebar button images */
char smooth_workspace_back;
char size_display; /* display type for resize geometry */
char move_display; /* display type for move geometry */
char window_placement; /* window placement mode */
char colormap_mode; /* colormap focus mode */
char focus_mode; /* window focusing mode */
signed char size_display; /* display type for resize geometry */
signed char move_display; /* display type for move geometry */
signed char window_placement; /* window placement mode */
signed char colormap_mode; /* colormap focus mode */
signed char focus_mode; /* window focusing mode */
char opaque_move; /* update window position during */
/* move */
@@ -308,7 +309,7 @@ typedef struct WPreferences {
char open_transients_with_parent; /* open transient window in
same workspace as parent */
char title_justification; /* titlebar text alignment */
signed char title_justification; /* titlebar text alignment */
char multi_byte_text;
#ifdef KEEP_XKB_LOCK_STATUS
@@ -327,7 +328,7 @@ typedef struct WPreferences {
char icon_box_position; /* position to place icons */
char iconification_style; /* position to place icons */
signed char iconification_style; /* position to place icons */
char disable_root_mouse; /* disable button events in root window */
@@ -341,7 +342,7 @@ typedef struct WPreferences {
WCoord *win_menu_pos;
char icon_yard; /* aka iconbox */
signed char icon_yard; /* aka iconbox */
int raise_delay; /* delay for autoraise. 0 is disabled */
@@ -350,9 +351,9 @@ typedef struct WPreferences {
int icon_size; /* size of the icon */
char menu_style; /* menu decoration style */
signed char menu_style; /* menu decoration style */
char workspace_name_display_position;
signed char workspace_name_display_position;
unsigned int modifier_mask; /* mask to use as kbd modifier */
@@ -376,9 +377,9 @@ typedef struct WPreferences {
char superfluous; /* Use superfluous things */
/* root window mouse bindings */
char select_button; /* button for window selection */
char windowl_button; /* button for window list menu */
char menu_button; /* button for app menu */
signed char select_button; /* button for window selection */
signed char windowl_button; /* button for window list menu */
signed char menu_button; /* button for app menu */
/* balloon text */
char window_balloon;
@@ -394,13 +395,13 @@ typedef struct WPreferences {
int dblclick_time; /* double click delay time in ms */
/* animate menus */
char menu_scroll_speed; /* how fast menus are scrolled */
signed char menu_scroll_speed; /* how fast menus are scrolled */
/* animate icon sliding */
char icon_slide_speed; /* icon slide animation speed */
signed char icon_slide_speed; /* icon slide animation speed */
/* shading animation */
char shade_speed;
signed char shade_speed;
int edge_resistance;
char attract;

View File

@@ -1213,12 +1213,7 @@ hideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate)
}
if (wwin->flags.inspector_open) {
WWindow *pwin = wwin->inspector->frame;
wWindowUnmap(pwin);
pwin->flags.hidden = 1;
wClientSetState(pwin, IconicState, icon->icon_win);
wHideInspectorForWindow(wwin);
}
wwin->flags.hidden = 1;
@@ -1273,7 +1268,7 @@ wHideOtherApplications(WWindow *awin)
&& wwin->frame->workspace == awin->screen_ptr->current_workspace
&& !(wwin->flags.miniaturized||wwin->flags.hidden)
&& !wwin->flags.internal_window
&& (!wwin->flags.inspector_open || wwin->inspector->frame!=awin)
&& wGetWindowOfInspectorForWindow(wwin) != awin
&& !WFLAGP(wwin, no_hide_others)) {
#ifdef REDUCE_APPICONS
@@ -1460,13 +1455,7 @@ unhideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate,
wClientSetState(wwin, NormalState, None);
wRaiseFrame(wwin->frame->core);
if (wwin->flags.inspector_open) {
WWindow *pwin = wwin->inspector->frame;
pwin->flags.hidden = 0;
pwin->flags.mapped = 1;
XMapWindow(dpy, pwin->client_win);
XMapWindow(dpy, pwin->frame->core->window);
wClientSetState(pwin, NormalState, None);
wUnhideInspectorForWindow(wwin);
}
#ifdef GNOME_STUFF

View File

@@ -67,9 +67,6 @@ extern Atom _XA_WM_PROTOCOLS;
void
wGetGeometryWindowSize(WScreen *scr, unsigned int *width,
unsigned int *height)
@@ -80,7 +77,6 @@ wGetGeometryWindowSize(WScreen *scr, unsigned int *width,
}
/*
*----------------------------------------------------------------------
* checkMouseSamplingRate-
@@ -1907,7 +1903,6 @@ wMouseResizeWindow(WWindow *wwin, XEvent *ev)
while (1) {
WMMaskEvent(dpy, KeyPressMask | ButtonMotionMask | ButtonReleaseMask
| ButtonPressMask | ExposureMask, &event);
if (!checkMouseSamplingRate(&event))
continue;
@@ -2115,19 +2110,13 @@ wSelectWindows(WScreen *scr, XEvent *ev)
int xp = ev->xbutton.x_root;
int yp = ev->xbutton.y_root;
int w = 0, h = 0;
int nx = xp, ny = yp, ox = xp, oy = yp, update_selection = 0;
XSegment segments[8]; /* 8 segments is the most possible */
/* it may be beneficial to use */
/* XDrawRectangle for 8 segment case */
int nsegs = 0;
int x = xp, y = yp;
#ifdef DEBUG
puts("Selecting windows");
#endif
if (XGrabPointer(dpy, scr->root_win, True, PointerMotionMask
| ButtonMotionMask | ButtonReleaseMask | ButtonPressMask
| EnterWindowMask | LeaveWindowMask , GrabModeAsync,
if (XGrabPointer(dpy, scr->root_win, False, ButtonMotionMask
| ButtonReleaseMask | ButtonPressMask, GrabModeAsync,
GrabModeAsync, None, wCursor[WCUR_DEFAULT],
CurrentTime) != Success) {
return;
@@ -2136,36 +2125,29 @@ wSelectWindows(WScreen *scr, XEvent *ev)
wUnselectWindows(scr);
XDrawRectangle(dpy, root, gc, xp, yp, w, h);
while (1) {
update_selection = 0;
WMMaskEvent(dpy, ButtonReleaseMask | PointerMotionMask
| ButtonPressMask, &event);
WMMaskEvent(dpy, ButtonReleaseMask | PointerMotionMask | LeaveWindowMask
| EnterWindowMask | ButtonPressMask,
&event);
if (!checkMouseSamplingRate(&event))
continue;
nsegs = 0;
switch (event.type) {
case LeaveNotify:
case EnterNotify:
#ifdef DEBUG
dbputs("got Enter/LeaveNotify in selection");
#endif
nx = event.xcrossing.x_root;
ny = event.xcrossing.y_root;
update_selection = 1;
break;
case MotionNotify:
#ifdef DEBUG
dbputs("got motionevent in selection");
#endif
nx = event.xmotion.x_root;
ny = event.xmotion.y_root;
update_selection = 1;
XDrawRectangle(dpy, root, gc, x, y, w, h);
x = event.xmotion.x_root;
if (x < xp) {
w = xp - x;
} else {
w = x - xp;
x = xp;
}
y = event.xmotion.y_root;
if (y < yp) {
h = yp - y;
} else {
h = y - yp;
y = yp;
}
XDrawRectangle(dpy, root, gc, x, y, w, h);
break;
case ButtonPress:
@@ -2175,22 +2157,10 @@ wSelectWindows(WScreen *scr, XEvent *ev)
if (event.xbutton.button != ev->xbutton.button)
break;
if(nx > xp) w = nx - xp;
else if(nx < xp) {
w = xp - nx;
xp = nx;
} else w = 0;
if(ny > yp) h = ny - yp;
else if(ny < yp) {
h = yp - ny;
yp = ny;
} else h = 0;
XDrawRectangle(dpy, root, gc, xp, yp, w, h);
XDrawRectangle(dpy, root, gc, x, y, w, h);
XUngrabServer(dpy);
XUngrabPointer(dpy, CurrentTime);
selectWindowsInside(scr, xp, yp, w + xp, h + yp);
selectWindowsInside(scr, x, y, x + w, y + h);
#ifdef KWM_HINTS
wKWMSelectRootRegion(scr, xp, yp, w, h,
@@ -2198,113 +2168,14 @@ wSelectWindows(WScreen *scr, XEvent *ev)
#endif /* KWM_HINTS */
#ifdef DEBUG
dbputs("End window selection");
puts("End window selection");
#endif
return;
default:
#ifdef DEBUG
dbputs("unknown event");
dbprintf("type: %u\n", event.type);
#endif
WMHandleEvent(&event);
break;
}
if(update_selection) {
/* stuff to change for movement along X axis */
if(nx != ox) {
/* erase old vertical line */
/* only if old vertical line exists */
/* and only if its different from other vertical line */
if(yp != oy && ox != xp) {
segments[nsegs].x1 = ox;
segments[nsegs].y1 = yp;
segments[nsegs].x2 = ox;
segments[nsegs].y2 = oy;
nsegs++;
}
/* draw new vertical line */
/* only if new vertical line exists */
/* and only if its different from the other vertical line */
if(yp != ny && nx != xp) {
segments[nsegs].x1 = nx;
segments[nsegs].y1 = yp;
segments[nsegs].x2 = nx;
segments[nsegs].y2 = ny;
nsegs++;
}
/* difference along x axis from old to new on ny horizontal */
/* only if our mouse doesnt move along Y, otherwise this gets */
/* done elsewhere */
if(ny == oy && nx != xp) {
segments[nsegs].x1 = ox;
segments[nsegs].y1 = ny;
segments[nsegs].x2 = nx;
segments[nsegs].y2 = ny;
nsegs++;
}
/* difference along x axis from old to new on yp horizontal */
segments[nsegs].x1 = nx;
segments[nsegs].y1 = yp;
segments[nsegs].x2 = ox;
segments[nsegs].y2 = yp;
nsegs++;
}
/* now for stuff to change for movement along Y axis */
if(ny != oy) {
/* erase old horizontal line */
/* only if old horizontal line exists */
/* and only if its different from other horizontal line */
if(xp != ox && oy != yp) {
segments[nsegs].x1 = ox;
segments[nsegs].y1 = oy;
segments[nsegs].x2 = xp;
segments[nsegs].y2 = oy;
nsegs++;
}
/* draw new horizontal line */
/* only if horizontal line exists, and if its different from other */
if(xp != nx && ny != yp) {
segments[nsegs].x1 = nx;
segments[nsegs].y1 = ny;
segments[nsegs].x2 = xp;
segments[nsegs].y2 = ny;
nsegs++;
}
/* difference along y axis from old to new on nx vertical */
/* only if no movement along x axis */
/* and only if we dont have duplicate lines */
if(nx == ox && nx != xp) {
segments[nsegs].x1 = nx;
segments[nsegs].y1 = oy;
segments[nsegs].x2 = nx;
segments[nsegs].y2 = ny;
nsegs++;
}
/* difference along y axis from old to new on xp vertical */
segments[nsegs].x1 = xp;
segments[nsegs].y1 = oy;
segments[nsegs].x2 = xp;
segments[nsegs].y2 = ny;
nsegs++;
}
ox = nx;
oy = ny;
XDrawSegments(dpy, root, gc, segments, nsegs);
}
}
}
#endif /* !LITE */

View File

@@ -710,6 +710,7 @@ StartUp(Bool defaultScreenOnly)
wCursor[WCUR_WAIT] = XCreateFontCursor(dpy, XC_watch);
wCursor[WCUR_QUESTION] = XCreateFontCursor(dpy, XC_question_arrow);
wCursor[WCUR_TEXT] = XCreateFontCursor(dpy, XC_xterm); /* odd name???*/
wCursor[WCUR_SELECT] = XCreateFontCursor(dpy, XC_cross);
/* emergency exit... */
sig_action.sa_handler = handleSig;

View File

@@ -1404,8 +1404,7 @@ wUnmanageWindow(WWindow *wwin, Bool restore, Bool destroyed)
/* First close attribute editor window if open */
if (wwin->flags.inspector_open) {
WWindow *pwin = wwin->inspector->frame; /* the inspector window */
(*pwin->frame->on_click_right)(NULL, pwin, NULL);
wCloseInspectorForWindow(wwin);
}
/* Close window menu if it's open for this window */

View File

@@ -45,9 +45,87 @@
#include "actions.h"
#include "winspector.h"
#include "dock.h"
#include "client.h"
#include <proplist.h>
typedef struct InspectorPanel {
struct InspectorPanel *nextPtr;
WWindow *frame;
WWindow *inspected; /* the window that's being inspected */
WMWindow *win;
Window parent;
/* common stuff */
WMButton *revertBtn;
WMButton *applyBtn;
WMButton *saveBtn;
WMPopUpButton *pagePopUp;
/* first page. general stuff */
WMFrame *specFrm;
WMButton *instRb;
WMButton *clsRb;
WMButton *bothRb;
WMButton *defaultRb;
WMButton *selWinB;
WMLabel *specLbl;
/* second page. attributes */
WMFrame *attrFrm;
WMButton *attrChk[10];
/* 3rd page. more attributes */
WMFrame *moreFrm;
#ifdef XKB_BUTTON_HINT
WMButton *moreChk[9];
#else
WMButton *moreChk[8];
#endif
/* 4th page. icon and workspace */
WMFrame *iconFrm;
WMLabel *iconLbl;
WMLabel *fileLbl;
WMTextField *fileText;
WMButton *alwChk;
/*
WMButton *updateIconBtn;
*/
WMButton *browseIconBtn;
WMFrame *wsFrm;
WMPopUpButton *wsP;
/* 5th page. application wide attributes */
WMFrame *appFrm;
WMButton *appChk[2];
unsigned int done:1;
unsigned int destroyed:1;
unsigned int choosingIcon:1;
} InspectorPanel;
extern Cursor wCursor[WCUR_LAST];
extern WDDomain *WDWindowAttributes;
static InspectorPanel *panelList=NULL;
@@ -95,8 +173,21 @@ static proplist_t Yes, No;
#define PHEIGHT 350
static void applySettings(WMButton *button, InspectorPanel *panel);
#define UNDEFINED_POS 0xffffff
static InspectorPanel *createInspectorForWindow(WWindow *wwin,
int xpos, int ypos,
Bool showSelectPanel);
static void
make_keys()
{
@@ -1021,8 +1112,60 @@ selectSpecification(WMWidget *bPtr, void *data)
}
#define SPEC_TEXT "The configuration will apply to all\n"\
"windows that have their WM_CLASS property"\
" set to the above selected\nname, when saved."
#define SELEC_TEXT "Click in the window you wish to inspect."
static void
selectWindow(WMWidget *bPtr, void *data)
{
InspectorPanel *panel = (InspectorPanel*)data;
WWindow *wwin = panel->inspected;
WScreen *scr = wwin->screen_ptr;
XEvent event;
WWindow *iwin;
if (XGrabPointer(dpy, scr->root_win, True,
ButtonPressMask, GrabModeAsync, GrabModeAsync, None,
wCursor[WCUR_SELECT], CurrentTime)!=GrabSuccess) {
wwarning("could not grab mouse pointer");
return;
}
WMSetLabelText(panel->specLbl, _(SELEC_TEXT));
WMMaskEvent(dpy, ButtonPressMask, &event);
XUngrabPointer(dpy, CurrentTime);
iwin = wWindowFor(event.xbutton.subwindow);
if (iwin && !iwin->flags.internal_window && iwin != wwin
&& !iwin->flags.inspector_open) {
iwin->flags.inspector_open = 1;
iwin->inspector = createInspectorForWindow(iwin,
panel->frame->frame_x,
panel->frame->frame_y,
True);
wCloseInspectorForWindow(wwin);
} else {
WMSetLabelText(panel->specLbl, _(SPEC_TEXT));
}
}
static InspectorPanel*
createInspectorForWindow(WWindow *wwin)
createInspectorForWindow(WWindow *wwin, int xpos, int ypos,
Bool showSelectPanel)
{
WScreen *scr = wwin->screen_ptr;
InspectorPanel *panel;
@@ -1095,7 +1238,7 @@ createInspectorForWindow(WWindow *wwin)
panel->specFrm = WMCreateFrame(panel->win);
WMSetFrameTitle(panel->specFrm, _("Window Specification"));
WMMoveWidget(panel->specFrm, 15, 65);
WMResizeWidget(panel->specFrm, frame_width, 105);
WMResizeWidget(panel->specFrm, frame_width, 145);
panel->defaultRb = WMCreateRadioButton(panel->specFrm);
@@ -1154,13 +1297,19 @@ createInspectorForWindow(WWindow *wwin)
if (selectedBtn)
WMSetButtonSelected(selectedBtn, True);
panel->selWinB = WMCreateCommandButton(panel->specFrm);
WMMoveWidget(panel->selWinB, 20, 145-24 - 10);
WMResizeWidget(panel->selWinB, frame_width - 2*10 - 20, 24);
WMSetButtonText(panel->selWinB, _("Select Window"));
WMSetButtonAction(panel->selWinB, selectWindow, panel);
panel->specLbl = WMCreateLabel(panel->win);
WMMoveWidget(panel->specLbl, 15, 170);
WMMoveWidget(panel->specLbl, 15, 210);
WMResizeWidget(panel->specLbl, frame_width, 100);
WMSetLabelText(panel->specLbl,
_("The configuration will apply to all\n"
"windows that have their WM_CLASS property"
" set to the above selected\nname, when saved."));
WMSetLabelText(panel->specLbl, _(SPEC_TEXT));
WMSetLabelTextAlignment(panel->specLbl, WACenter);
/**** attributes ****/
@@ -1249,11 +1398,13 @@ createInspectorForWindow(WWindow *wwin)
WMMoveWidget(panel->moreFrm, 15, 45);
WMResizeWidget(panel->moreFrm, frame_width, 250);
for (i=0;
#ifdef XKB_BUTTON_HINT
for (i=0; i < 9; i++) {
i < 9;
#else
for (i=0; i < 8; i++) {
i < 8;
#endif
i++) {
char *caption = NULL;
int flag = 0;
char *descr = NULL;
@@ -1492,8 +1643,13 @@ createInspectorForWindow(WWindow *wwin)
if (panel->appFrm)
WMMapSubwidgets(panel->appFrm);
if (showSelectPanel) {
WMSetPopUpButtonSelectedItem(panel->pagePopUp, 0);
changePage(panel->pagePopUp, panel);
} else {
WMSetPopUpButtonSelectedItem(panel->pagePopUp, 1);
changePage(panel->pagePopUp, panel);
}
parent = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, PWIDTH, PHEIGHT,
@@ -1506,12 +1662,17 @@ createInspectorForWindow(WWindow *wwin)
XSetTransientForHint(dpy, parent, wwin->client_win);
if (xpos == UNDEFINED_POS) {
x = wwin->frame_x+wwin->frame->core->width/2;
y = wwin->frame_y+wwin->frame->top_width*2;
if (y + PHEIGHT > scr->scr_height)
y = scr->scr_height - PHEIGHT - 30;
if (x + PWIDTH > scr->scr_width)
x = scr->scr_width - PWIDTH;
} else {
x = xpos;
y = ypos;
}
panel->frame = wManageInternalWindow(scr, parent, wwin->client_win,
"Inspector", x, y, PWIDTH, PHEIGHT);
@@ -1551,7 +1712,58 @@ wShowInspectorForWindow(WWindow *wwin)
make_keys();
wwin->flags.inspector_open = 1;
wwin->inspector = createInspectorForWindow(wwin);;
wwin->inspector = createInspectorForWindow(wwin, UNDEFINED_POS,
UNDEFINED_POS, False);
}
void
wHideInspectorForWindow(WWindow *wwin)
{
WWindow *pwin = wwin->inspector->frame;
wWindowUnmap(pwin);
pwin->flags.hidden = 1;
wClientSetState(pwin, IconicState, None);
}
void
wUnhideInspectorForWindow(WWindow *wwin)
{
WWindow *pwin = wwin->inspector->frame;
pwin->flags.hidden = 0;
pwin->flags.mapped = 1;
XMapWindow(dpy, pwin->client_win);
XMapWindow(dpy, pwin->frame->core->window);
wClientSetState(pwin, NormalState, None);
}
WWindow*
wGetWindowOfInspectorForWindow(WWindow *wwin)
{
if (wwin->inspector) {
assert(wwin->flags.inspector_open != 0);
return wwin->inspector->frame;
} else
return NULL;
}
void
wCloseInspectorForWindow(WWindow *wwin)
{
WWindow *pwin = wwin->inspector->frame; /* the inspector window */
(*pwin->frame->on_click_right)(NULL, pwin, NULL);
}

View File

@@ -25,73 +25,16 @@
#include "window.h"
typedef struct InspectorPanel {
struct InspectorPanel *nextPtr;
WWindow *frame;
WWindow *inspected; /* the window that's being inspected */
WMWindow *win;
Window parent;
/* common stuff */
WMButton *revertBtn;
WMButton *applyBtn;
WMButton *saveBtn;
WMPopUpButton *pagePopUp;
/* first page. general stuff */
WMFrame *specFrm;
WMButton *instRb;
WMButton *clsRb;
WMButton *bothRb;
WMButton *defaultRb;
WMLabel *specLbl;
/* second page. attributes */
WMFrame *attrFrm;
WMButton *attrChk[10];
/* 3rd page. more attributes */
WMFrame *moreFrm;
#ifdef XKB_BUTTON_HINT
WMButton *moreChk[9];
#else
WMButton *moreChk[8];
#endif
/* 4th page. icon and workspace */
WMFrame *iconFrm;
WMLabel *iconLbl;
WMLabel *fileLbl;
WMTextField *fileText;
WMButton *alwChk;
/*
WMButton *updateIconBtn;
*/
WMButton *browseIconBtn;
WMFrame *wsFrm;
WMPopUpButton *wsP;
/* 5th page. application wide attributes */
WMFrame *appFrm;
WMButton *appChk[2];
unsigned int done:1;
unsigned int destroyed:1;
unsigned int choosingIcon:1;
} InspectorPanel;
void wShowInspectorForWindow(WWindow *wwin);
void wHideInspectorForWindow(WWindow *wwin);
void wUnhideInspectorForWindow(WWindow *wwin);
void wDestroyInspectorPanels();
WWindow *wGetWindowOfInspectorForWindow(WWindow *wwin);
void wCloseInspectorForWindow(WWindow *wwin);
#endif