diff --git a/src/appicon.c b/src/appicon.c index 5f9a8a6..7961882 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -61,7 +61,7 @@ #define MOD_MASK wPreferences.modifier_mask #define ICON_SIZE wPreferences.icon_size -static void iconDblClick(WObjDescriptor * desc, XEvent * event); +static void iconDblClick(WObjDescriptor * desc, WMEvent * event); static void iconExpose(WObjDescriptor * desc, WBackendEvent * event); static void wApplicationSaveIconPathFor(const char *iconPath, const char *wm_instance, const char *wm_class); static WAppIcon *wAppIconCreate(WWindow * leader_win); @@ -621,7 +621,7 @@ static void iconExpose(WObjDescriptor *desc, WBackendEvent *event) wAppIconPaint(desc->parent); } -static void iconDblClick(WObjDescriptor *desc, XEvent *event) +static void iconDblClick(WObjDescriptor *desc, WMEvent *event) { WAppIcon *aicon = desc->parent; WApplication *wapp; @@ -632,25 +632,25 @@ static void iconDblClick(WObjDescriptor *desc, XEvent *event) wapp = wApplicationOf(aicon->icon->owner->main_window); - if (event->xbutton.state & ControlMask) { + if (event->u.button.state & ControlMask) { relaunchApplication(wapp); return; } - unhideHere = (event->xbutton.state & ShiftMask); + unhideHere = (event->u.button.state & ShiftMask); /* go to the last workspace that the user worked on the app */ if (!unhideHere && wapp->last_workspace != scr->current_workspace) wWorkspaceChange(scr, wapp->last_workspace); - wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere); + wUnhideApplication(wapp, event->u.button.button == Button2, unhideHere); - if (event->xbutton.state & MOD_MASK) + if (event->u.button.state & MOD_MASK) wHideOtherApplications(aicon->icon->owner); } void appIconMouseDown(WObjDescriptor * desc, WBackendEvent * event) { - XEvent *xev = event->_x11_raw; + WAppIcon *aicon = desc->parent; WScreen *scr = aicon->icon->core->screen_ptr; Bool hasMoved; @@ -661,7 +661,7 @@ void appIconMouseDown(WObjDescriptor * desc, WBackendEvent * event) if (IsDoubleClick(scr, event)) { /* Middle or right mouse actions were handled on first click */ if (event->u.button.button == Button1) - iconDblClick(desc, xev); + iconDblClick(desc, event); return; } @@ -698,14 +698,14 @@ void appIconMouseDown(WObjDescriptor * desc, WBackendEvent * event) return; } - hasMoved = wHandleAppIconMove(aicon, xev); + hasMoved = wHandleAppIconMove(aicon, event); if (wPreferences.single_click && !hasMoved && aicon->dock != NULL) { - iconDblClick(desc, xev); + iconDblClick(desc, event); } } -Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event) +Bool wHandleAppIconMove(WAppIcon *aicon, WMEvent *event) { WIcon *icon = aicon->icon; WScreen *scr = icon->core->screen_ptr; @@ -720,13 +720,13 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event) int omnipresent = aicon->omnipresent; /* this must be cached */ Bool showed_all_clips = False; - int clickButton = event->xbutton.button; + int clickButton = event->u.button.button; Pixmap ghost = None; Window wins[2]; /* Managing shadow window */ WMEvent ev; int x = aicon->x_pos, y = aicon->y_pos; - int ofs_x = event->xbutton.x, ofs_y = event->xbutton.y; + int ofs_x = event->u.button.x, ofs_y = event->u.button.y; int shad_x = x, shad_y = y; int ix = aicon->xindex, iy = aicon->yindex; int i; @@ -737,7 +737,7 @@ Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event) if (wPreferences.flags.noupdates && originalDock != NULL) return False; - if (!(event->xbutton.state & MOD_MASK)) + if (!(event->u.button.state & MOD_MASK)) wRaiseFrame(icon->core); else { /* If Mod is pressed for an docked appicon, assume it is to undock it, diff --git a/src/appicon.h b/src/appicon.h index 77f1311..1b74114 100644 --- a/src/appicon.h +++ b/src/appicon.h @@ -71,7 +71,7 @@ typedef struct WAppIcon { WAppIcon *wAppIconCreateForDock(WScreen *scr, const char *command, const char *wm_instance, const char *wm_class, int tile); -Bool wHandleAppIconMove(WAppIcon *aicon, XEvent *event); +Bool wHandleAppIconMove(WAppIcon *aicon, WMEvent *event); void wAppIconDestroy(WAppIcon *aicon); void wAppIconPaint(WAppIcon *aicon); diff --git a/src/dock.c b/src/dock.c index e3d9454..a6cab4d 100644 --- a/src/dock.c +++ b/src/dock.c @@ -105,7 +105,7 @@ static void clipIconExpose(WObjDescriptor *desc, WBackendEvent *event); static void clipLeave(WDock *dock); -static void handleClipChangeWorkspace(WScreen *scr, XEvent *event); +static void handleClipChangeWorkspace(WScreen *scr, WMEvent *event); static void clipEnterNotify(WObjDescriptor *desc, WBackendEvent *event); static void clipLeaveNotify(WObjDescriptor *desc, WBackendEvent *event); @@ -3361,7 +3361,7 @@ static void toggleCollapsed(WDock *dock) } } -static void openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event) +static void openDockMenu(WDock *dock, WAppIcon *aicon, WMEvent *event) { WScreen *scr = dock->screen_ptr; WObjDescriptor *desc; @@ -3522,8 +3522,8 @@ static void openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event) wMenuRealize(dock->menu); if (dock->type == WM_CLIP || dock->type == WM_DRAWER) { - /*x_pos = event->xbutton.x_root+2; */ - x_pos = event->xbutton.x_root - dock->menu->frame->core->width / 2 - 1; + /*x_pos = event->u.button.x_root+2; */ + x_pos = event->u.button.x_root - dock->menu->frame->core->width / 2 - 1; if (x_pos < 0) { x_pos = 0; } else if (x_pos + dock->menu->frame->core->width > scr->scr_width - 2) { @@ -3536,50 +3536,50 @@ static void openDockMenu(WDock *dock, WAppIcon *aicon, XEvent *event) - dock->menu->frame->core->width - 3; } - wMenuMapAt(dock->menu, x_pos, event->xbutton.y_root + 2, False); + wMenuMapAt(dock->menu, x_pos, event->u.button.y_root + 2, False); - /* allow drag select */ - event->xany.send_event = True; + /* allow drag select — forward event to menu's mousedown handler */ + event->u.button.send_event = 1; desc = &dock->menu->menu->descriptor; - { WBackendEvent bev; x11_translate_event(event, &bev); (*desc->handle_mousedown) (desc, &bev); } + (*desc->handle_mousedown)(desc, event); } /******************************************************************/ -static void iconDblClick(WObjDescriptor *desc, XEvent *event) +static void iconDblClick(WObjDescriptor *desc, WMEvent *event) { WAppIcon *btn = desc->parent; WDock *dock = btn->dock; WApplication *wapp = NULL; int unhideHere = 0; - if (btn->icon->owner && !(event->xbutton.state & ControlMask)) { + if (btn->icon->owner && !(event->u.button.state & ControlMask)) { wapp = wApplicationOf(btn->icon->owner->main_window); assert(wapp != NULL); - unhideHere = (event->xbutton.state & ShiftMask); + unhideHere = (event->u.button.state & ShiftMask); /* go to the last workspace that the user worked on the app */ if (wapp->last_workspace != dock->screen_ptr->current_workspace && !unhideHere) wWorkspaceChange(dock->screen_ptr, wapp->last_workspace); - wUnhideApplication(wapp, event->xbutton.button == Button2, unhideHere); + wUnhideApplication(wapp, event->u.button.button == Button2, unhideHere); - if (event->xbutton.state & MOD_MASK) + if (event->u.button.state & MOD_MASK) wHideOtherApplications(btn->icon->owner); } else { - if (event->xbutton.button == Button1) { - if (event->xbutton.state & MOD_MASK) { + if (event->u.button.button == Button1) { + if (event->u.button.state & MOD_MASK) { /* raise/lower dock */ toggleLowered(dock); } else if (btn == dock->screen_ptr->clip_icon) { - if (getClipButton(event->xbutton.x, event->xbutton.y) != CLIP_IDLE) + if (getClipButton(event->u.button.x, event->u.button.y) != CLIP_IDLE) handleClipChangeWorkspace(dock->screen_ptr, event); else if (wPreferences.flags.clip_merged_in_dock) { // Is actually the dock if (btn->command) { - if (!btn->launching && (!btn->running || (event->xbutton.state & ControlMask))) + if (!btn->launching && (!btn->running || (event->u.button.state & ControlMask))) launchDockedApplication(btn, False); } else @@ -3592,7 +3592,7 @@ static void iconDblClick(WObjDescriptor *desc, XEvent *event) } else if (wIsADrawer(btn)) { toggleCollapsed(dock); } else if (btn->command) { - if (!btn->launching && (!btn->running || (event->xbutton.state & ControlMask))) + if (!btn->launching && (!btn->running || (event->u.button.state & ControlMask))) launchDockedApplication(btn, False); } else if (btn->xindex == 0 && btn->yindex == 0 && btn->dock->type == WM_DOCK) { wShowInfoPanel(dock->screen_ptr); @@ -3601,10 +3601,10 @@ static void iconDblClick(WObjDescriptor *desc, XEvent *event) } } -static void handleDockMove(WDock *dock, WAppIcon *aicon, XEvent *event) +static void handleDockMove(WDock *dock, WAppIcon *aicon, WMEvent *event) { WScreen *scr = dock->screen_ptr; - int ofs_x = event->xbutton.x, ofs_y = event->xbutton.y; + int ofs_x = event->u.button.x, ofs_y = event->u.button.y; WIcon *icon = aicon->icon; WAppIcon *tmpaicon; WDrawerChain *dc; @@ -3771,7 +3771,7 @@ static void handleDockMove(WDock *dock, WAppIcon *aicon, XEvent *event) break; case WME_BUTTON_RELEASE: - if (ev.u.button.button != event->xbutton.button) + if (ev.u.button.button != event->u.button.button) break; wm_backend->pointer_ungrab(0); if (dock->type == WM_DRAWER) { @@ -3831,14 +3831,14 @@ static int getClipButton(int px, int py) return CLIP_IDLE; } -static void handleClipChangeWorkspace(WScreen *scr, XEvent *event) +static void handleClipChangeWorkspace(WScreen *scr, WMEvent *event) { WMEvent ev; int done, direction, new_ws; int new_dir; WDock *clip = scr->clip_icon->dock; - direction = getClipButton(event->xbutton.x, event->xbutton.y); + direction = getClipButton(event->u.button.x, event->u.button.y); clip->lclip_button_pushed = direction == CLIP_REWIND; clip->rclip_button_pushed = direction == CLIP_FORWARD; @@ -3866,7 +3866,7 @@ static void handleClipChangeWorkspace(WScreen *scr, XEvent *event) break; case WME_BUTTON_RELEASE: - if (ev.u.button.button == event->xbutton.button) + if (ev.u.button.button == event->u.button.button) done = 1; } } @@ -3874,7 +3874,7 @@ static void handleClipChangeWorkspace(WScreen *scr, XEvent *event) clip->lclip_button_pushed = 0; clip->rclip_button_pushed = 0; - new_ws = wPreferences.ws_advance || (event->xbutton.state & ControlMask); + new_ws = wPreferences.ws_advance || (event->u.button.state & ControlMask); if (direction == CLIP_FORWARD) { if (scr->current_workspace < scr->workspace_count - 1) @@ -3895,7 +3895,6 @@ static void handleClipChangeWorkspace(WScreen *scr, XEvent *event) static void iconMouseDown(WObjDescriptor *desc, WBackendEvent *event) { - XEvent *xev = event->_x11_raw; WAppIcon *aicon = desc->parent; WDock *dock = aicon->dock; WScreen *scr = aicon->icon->core->screen_ptr; @@ -3912,7 +3911,7 @@ static void iconMouseDown(WObjDescriptor *desc, WBackendEvent *event) /* double-click was not in the main clip icon */ if (dock->type != WM_CLIP || aicon->xindex != 0 || aicon->yindex != 0 || getClipButton(event->u.button.x, event->u.button.y) == CLIP_IDLE) { - iconDblClick(desc, xev); + iconDblClick(desc, event); return; } } @@ -3931,13 +3930,13 @@ static void iconMouseDown(WObjDescriptor *desc, WBackendEvent *event) if (aicon->yindex == 0 && aicon->xindex == 0) { if (getClipButton(event->u.button.x, event->u.button.y) != CLIP_IDLE && (dock->type == WM_CLIP || (dock->type == WM_DOCK && wPreferences.flags.clip_merged_in_dock))) - handleClipChangeWorkspace(scr, xev); + handleClipChangeWorkspace(scr, event); else - handleDockMove(dock, aicon, xev); + handleDockMove(dock, aicon, event); } else { - Bool hasMoved = wHandleAppIconMove(aicon, xev); + Bool hasMoved = wHandleAppIconMove(aicon, event); if (wPreferences.single_click && !hasMoved) - iconDblClick(desc, xev); + iconDblClick(desc, event); } } else if (event->u.button.button == Button2 && aicon == scr->clip_icon) { if (!scr->clip_ws_menu) @@ -3974,7 +3973,7 @@ static void iconMouseDown(WObjDescriptor *desc, WBackendEvent *event) return; } - openDockMenu(dock, aicon, xev); + openDockMenu(dock, aicon, event); } else if (event->u.button.button == Button2) { WAppIcon *btn = desc->parent; @@ -4028,7 +4027,6 @@ static void clipEnterNotify(WObjDescriptor *desc, WBackendEvent *event) static void clipLeave(WDock *dock) { - XEvent event; WObjDescriptor *desc = NULL; WDock *tmp;