Shuffle stuff around to more appropriate locations.

SVN revision: 16522
This commit is contained in:
Kim Woelders 2005-09-04 12:43:13 +00:00
parent 0b3a046df9
commit 4ae7217564
8 changed files with 96 additions and 113 deletions

View File

@ -1665,7 +1665,6 @@ void SettingsComposite(void);
/* setup.c */
void MapUnmap(int start);
void SetupX(const char *dstr);
void RootResize(int root, int w, int h);
/* size.c */
void MaxSize(EWin * ewin, const char *resize_type);

View File

@ -203,7 +203,7 @@ SetCurrentArea(int ax, int ay)
/* remove lots of event masks from windows.. we dont want to bother */
/* handling events as a result of our playing wiht windows */
FocusNewDeskBegin();
DeskSwitchStart();
/* set the current area up in out data structs */
DeskSetCurrentArea(ax, ay);
@ -269,7 +269,7 @@ SetCurrentArea(int ax, int ay)
ActionsResume();
/* re-focus on a new ewin on that new desktop area */
FocusNewDesk();
DeskSwitchDone();
ModulesSignal(ESIGNAL_AREA_SWITCH_DONE, DesksGetCurrent());

View File

@ -29,6 +29,9 @@
#include "tooltips.h"
#include "xwin.h"
#include <time.h>
#if USE_XRANDR
#include <X11/extensions/Xrandr.h>
#endif
#define EDESK_EVENT_MASK \
(ButtonPressMask | ButtonReleaseMask | \
@ -1037,6 +1040,27 @@ DeskGotoNum(unsigned int desk)
DeskGoto(dsk);
}
void
DeskSwitchStart(void)
{
FocusNewDeskBegin();
/* we are about to flip desktops or areas - disable enter and leave events
* temporarily */
EwinsEventsConfigure(0);
DesksEventsConfigure(0);
}
void
DeskSwitchDone(void)
{
/* we flipped - re-enable enter and leave events */
EwinsEventsConfigure(1);
DesksEventsConfigure(1);
FocusNewDesk();
}
void
DeskGoto(Desk * dsk)
{
@ -1048,7 +1072,7 @@ DeskGoto(Desk * dsk)
ModulesSignal(ESIGNAL_DESK_SWITCH_START, NULL);
ActionsSuspend();
FocusNewDeskBegin();
DeskSwitchStart();
if (dsk->num > 0)
{
@ -1101,7 +1125,7 @@ DeskGoto(Desk * dsk)
}
ActionsResume();
FocusNewDesk();
DeskSwitchDone();
ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
}
@ -1133,9 +1157,9 @@ DeskRaise(unsigned int desk)
if (EventDebug(EDBUG_TYPE_DESKS))
Eprintf("DeskRaise(%d) current=%d\n", desk, desks.current->num);
FocusNewDeskBegin();
DeskSwitchStart();
DeskEnter(dsk);
FocusNewDesk();
DeskSwitchDone();
ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
@ -1148,7 +1172,7 @@ DeskLower(unsigned int desk)
if ((desk <= 0) || (desk >= Conf.desks.num))
return;
FocusNewDeskBegin();
DeskSwitchStart();
MoveToDeskBottom(desk);
if (EventDebug(EDBUG_TYPE_DESKS))
@ -1165,7 +1189,7 @@ DeskLower(unsigned int desk)
EwinsMoveStickyToDesk(desks.current);
ButtonsMoveStickyToDesk(desks.current);
DesksStackingCheck();
FocusNewDesk();
DeskSwitchDone();
if (Mode.mode == MODE_NONE)
ModulesSignal(ESIGNAL_DESK_SWITCH_DONE, NULL);
HintsSetCurrentDesktop();
@ -1382,6 +1406,37 @@ DeskEventButtonRelease(Desk * dsk, XEvent * ev)
DeskCheckAction(dsk, ev);
}
static void
DeskRootResize(int root, int w, int h)
{
if (EventDebug(EDBUG_TYPE_DESKS))
Eprintf("DeskRootResize %d %dx%d\n", root, w, h);
if (root)
{
#if 0
RRoot.w = DisplayWidth(disp, RRoot.scr);
RRoot.h = DisplayHeight(disp, RRoot.scr);
if (w != RRoot.w || h != RRoot.h)
Eprintf
("DeskRootResize (root): Screen size mismatch: root=%dx%d event=%dx%d\n",
RRoot.w, RRoot.h, w, h);
#endif
RRoot.w = w;
RRoot.h = h;
}
if (w == VRoot.w && h == VRoot.h)
return;
EWindowSync(VRoot.win);
VRoot.w = w;
VRoot.h = h;
DesksResize(w, h);
}
static ActionClass *
DeskGetAclass(void *data __UNUSED__)
{
@ -1439,6 +1494,26 @@ DeskHandleEvents(XEvent * ev, void *prm)
case LeaveNotify:
FocusHandleLeave(NULL, ev);
break;
case MotionNotify:
/* Motion over desk buttons doesn't go here - We probably don't care much. */
DesksSetCurrent(DesktopAt(Mode.events.x, Mode.events.y));
break;
case ConfigureNotify:
if (ev->xconfigure.window == VRoot.win)
DeskRootResize(0, ev->xconfigure.width, ev->xconfigure.height);
break;
#if USE_XRANDR
case EX_EVENT_SCREEN_CHANGE_NOTIFY:
{
XRRScreenChangeNotifyEvent *rrev = (XRRScreenChangeNotifyEvent *) ev;
DeskRootResize(1, rrev->width, rrev->height);
}
break;
#endif
}
DeskHandleTooltip(dsk, ev);

View File

@ -54,6 +54,8 @@ void DeskRefresh(Desk * dsk);
void DeskAssignBg(unsigned int desk, Background * bg);
void DeskSetBg(Desk * dsk, Background * bg, int refresh);
Desk *DesktopAt(int x, int y);
void DeskSwitchStart(void);
void DeskSwitchDone(void);
void DeskGoto(Desk * dsk);
void DeskGotoNum(unsigned int desk);
void StackDesktop(Desk * dsk);

View File

@ -22,7 +22,6 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h" /* FIXME - Should not be here */
#include "emodule.h"
#include "ewins.h" /* FIXME - Should not be here */
#include "xwin.h"
@ -193,6 +192,11 @@ HandleEvent(XEvent * ev)
case MotionNotify:
Mode.events.time = ev->xmotion.time;
Mode.events.px = Mode.events.x;
Mode.events.py = Mode.events.y;
ModeGetXY(ev->xmotion.root, ev->xmotion.x_root, ev->xmotion.y_root);
ActionsHandleMotion();
break;
case EnterNotify:
@ -221,6 +225,10 @@ HandleEvent(XEvent * ev)
Mode.events.time = ev->xproperty.time;
break;
case ClientMessage:
HintsProcessClientMessage(&(ev->xclient));
break;
do_stuff:
ActionclassesEvent(ev, GetFocusEwin());
break;
@ -252,48 +260,6 @@ HandleEvent(XEvent * ev)
SoundPlay("SOUND_BUTTON_RAISE");
ActionsEnd(NULL);
break;
case MotionNotify: /* 6 */
Mode.events.px = Mode.events.x;
Mode.events.py = Mode.events.y;
ModeGetXY(ev->xmotion.root, ev->xmotion.x_root, ev->xmotion.y_root);
DesksSetCurrent(DesktopAt(Mode.events.x, Mode.events.y));
ActionsHandleMotion();
break;
case EnterNotify: /* 7 */
break;
case LeaveNotify: /* 8 */
break;
case MapRequest: /* 20 */
break;
case ReparentNotify: /* 21 */
break;
case ConfigureNotify: /* 22 */
if (ev->xconfigure.window == VRoot.win)
RootResize(0, ev->xconfigure.width, ev->xconfigure.height);
break;
case ConfigureRequest: /* 23 */
break;
case ResizeRequest: /* 25 */
break;
case CirculateRequest: /* 27 */
break;
case PropertyNotify: /* 28 */
break;
case ClientMessage: /* 33 */
HintsProcessClientMessage(&(ev->xclient));
break;
#if USE_XRANDR
case EX_EVENT_SCREEN_CHANGE_NOTIFY:
{
XRRScreenChangeNotifyEvent *rrev = (XRRScreenChangeNotifyEvent *) ev;
RootResize(1, rrev->width, rrev->height);
}
break;
#endif
}
/* The new event dispatcher */

View File

@ -1873,10 +1873,6 @@ EwinHandleEventsRoot(XEvent * ev, void *prm __UNUSED__)
case DestroyNotify:
/* Catch clients destroyed after MapRequest but before being reparented */
ewin = EwinFindByClient(ev->xdestroywindow.window);
#if 0 /* FIXME - Should not be here - Remove? */
if (!ewin)
ewin = EwinFindByFrame(ev->xdestroywindow.window);
#endif
if (ewin)
EwinEventDestroy(ewin);
break;

View File

@ -466,37 +466,17 @@ FocusSet(void)
focus_pending_ewin = focus_pending_new = NULL;
}
static int focus_new_desk_nesting = 0; /* Obsolete? */
void
FocusNewDeskBegin(void)
{
if (focus_new_desk_nesting++)
return;
FocusToEWin(NULL, FOCUS_DESK_LEAVE);
/* we are about to flip desktops or areas - disable enter and leave events
* temporarily */
EwinsEventsConfigure(0);
DesksEventsConfigure(0);
}
void
FocusNewDesk(void)
{
EWin *ewin;
if (--focus_new_desk_nesting)
return;
/* we flipped - re-enable enter and leave events */
EwinsEventsConfigure(1);
DesksEventsConfigure(1);
/* Set the mouse-over window */
ewin = GetEwinByCurrentPointer();
Mode.mouse_over_ewin = ewin;
Mode.mouse_over_ewin = GetEwinByCurrentPointer();
FocusToEWin(NULL, FOCUS_DESK_ENTER);
}
@ -504,14 +484,11 @@ FocusNewDesk(void)
static void
FocusInit(void)
{
EWin *ewin;
/* Start focusing windows */
FocusEnable(1);
/* Set the mouse-over window */
ewin = GetEwinByCurrentPointer();
Mode.mouse_over_ewin = ewin;
Mode.mouse_over_ewin = GetEwinByCurrentPointer();
focus_pending_why = 0;
focus_pending_ewin = focus_pending_new = NULL;

View File

@ -22,7 +22,6 @@
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "E.h"
#include "desktops.h" /* FIXME - Should not be here */
#include "ewins.h"
#include "xwin.h"
#include <signal.h>
@ -339,34 +338,3 @@ SetupX(const char *dstr)
ScreenInit();
ZoomInit();
}
void
RootResize(int root, int w, int h)
{
if (EventDebug(EDBUG_TYPE_DESKS))
Eprintf("RootResize %d %dx%d\n", root, w, h);
if (root)
{
#if 0
RRoot.w = DisplayWidth(disp, RRoot.scr);
RRoot.h = DisplayHeight(disp, RRoot.scr);
if (w != RRoot.w || h != RRoot.h)
Eprintf
("RootResize (root): Screen size mismatch: root=%dx%d event=%dx%d\n",
RRoot.w, RRoot.h, w, h);
#endif
RRoot.w = w;
RRoot.h = h;
}
if (w == VRoot.w && h == VRoot.h)
return;
EWindowSync(VRoot.win);
VRoot.w = w;
VRoot.h = h;
DesksResize(w, h);
}