Example #1
0
bool EngineCore::inputMotionEvent(int action) {
    bool ret = handleMotion(action);
    if (!ret) {
        switch(action) {
            case AMOTION_EVENT_ACTION_DOWN:
                DEBUG(Log::F_MOTION_EVENT, "AMOTION_EVENT_ACTION_DOWN");
                ret = true;
                break;
            case AMOTION_EVENT_ACTION_MOVE:
                DEBUG(Log::F_MOTION_EVENT, "AMOTION_EVENT_ACTION_MOVE");
                ret = true;
                break;
            case AMOTION_EVENT_ACTION_UP:
                DEBUG(Log::F_MOTION_EVENT, "AMOTION_EVENT_ACTION_UP");
                ret = true;
                break;
        }
    }
    return ret;
}
Example #2
0
QString Converter::encodingSettingsToX264(QString line)
{
  if (line.isEmpty()) {
    return QObject::tr("empty input nothing to do,...");
  }
  ignored.clear();
  QStringList x264;
  QStringList lines = line.split("/", QString::SkipEmptyParts);
  bool modded = false;
  foreach(line, lines) {
    line = line.trimmed();
    if (handleBFrames(line, x264)) {
      continue;
    }
    if (handleGop(line, x264)) {
      continue;
    }
    if (handleFrame(line, x264, modded)) {
      continue;
    }
    if (handleMotion(line, x264)) {
      continue;
    }
    if (handleRate(line, x264)) {
      continue;
    }
    if (handleRest(line, x264)) {
      continue;
    }
    if (handleGlobal(line, x264)) {
      continue;
    }
    if (line.startsWith("rc=")) {
      line += " " + QObject::tr("since rc does not hold any useful info");
    }
    ignored << line;
  }
void
EventsHandler::Run() {
	XSelectInput(mShared.display, mShared.RootWindow, 
		SubstructureRedirectMask|SubstructureNotifyMask|ButtonPressMask
|EnterWindowMask|LeaveWindowMask|StructureNotifyMask|PropertyChangeMask|KeyPressMask);

	while (isRunning) {
		XNextEvent(mShared.display, &event);
		RunHandlers();
		
		std::cout << event.type << std::endl;
		//std::cout << "ConfigureRequest is " << ConfigureRequest << std::endl;
		//std::cout << "RootWindow:" << mShared.RootWindow << std::endl;

		switch (event.type) {
			case Expose:
			break;
			case ConfigureRequest:
			break;
			case KeyPress:
				handleKeyPress(&event);
			break;
			case ButtonPress:
				handleButtonPress(&event);
			break;
			case MotionNotify:
				handleMotion(&event);
			break;
			default:
				//std::cout << event.type << std::endl;
			break;
		}
	
	}

	XCloseDisplay(mShared.display);
}
void XWaylandManager::wmEvents()
{
    // Uncomment if you want to be flooded by messages
    //qCDebug(XWAYLAND_TRACE) << "WM event";

    xcb_generic_event_t *event;

    while ((event = xcb_poll_for_event(Xcb::connection()))) {
        //handle selection event
        //handle dnd event

        int type = event->response_type & ~0x80;
        switch (type) {
        case XCB_BUTTON_PRESS:
        case XCB_BUTTON_RELEASE:
            handleButton((xcb_button_press_event_t *)event);
            break;
        case XCB_ENTER_NOTIFY:
            handleEnter((xcb_enter_notify_event_t *)event);
            break;
        case XCB_LEAVE_NOTIFY:
            handleLeave((xcb_leave_notify_event_t *)event);
            break;
        case XCB_MOTION_NOTIFY:
            handleMotion((xcb_motion_notify_event_t *)event);
            break;
        case XCB_CREATE_NOTIFY:
            handleCreateNotify((xcb_create_notify_event_t *)event);
            break;
        case XCB_MAP_REQUEST:
            handleMapRequest((xcb_map_request_event_t *)event);
            break;
        case XCB_MAP_NOTIFY:
            handleMapNotify((xcb_map_notify_event_t *)event);
            break;
        case XCB_UNMAP_NOTIFY:
            handleUnmapNotify((xcb_unmap_notify_event_t *)event);
            break;
        case XCB_REPARENT_NOTIFY:
            handleReparentNotify((xcb_reparent_notify_event_t *)event);
            break;
        case XCB_CONFIGURE_REQUEST:
            handleConfigureRequest((xcb_configure_request_event_t *)event);
            break;
        case XCB_CONFIGURE_NOTIFY:
            handleConfigureNotify((xcb_configure_notify_event_t *)event);
            break;
        case XCB_DESTROY_NOTIFY:
            handleDestroyNotify((xcb_destroy_notify_event_t *)event);
            break;
        case XCB_MAPPING_NOTIFY:
            break;
        case XCB_PROPERTY_NOTIFY:
            handlePropertyNotify((xcb_property_notify_event_t *)event);
            break;
        case XCB_CLIENT_MESSAGE:
            handleClientMessage((xcb_client_message_event_t *)event);
            break;
        default:
            break;
        }

        free(event);
    }

    xcb_flush(Xcb::connection());
}
Example #5
0
static void handleActionEvents(XEvent * event, void *data)
{
	Scroller *sPtr = (Scroller *) data;
	int wheelDecrement, wheelIncrement;
	int id, dd;

	/* check if we're really dealing with a scroller, as something
	 * might have gone wrong in the event dispatching stuff */
	CHECK_CLASS(sPtr, WC_Scroller);

	id = sPtr->flags.incrDown;
	dd = sPtr->flags.decrDown;

	switch (event->type) {
	case EnterNotify:
		break;

	case LeaveNotify:
		if (sPtr->timerID) {
			WMDeleteTimerHandler(sPtr->timerID);
			sPtr->timerID = NULL;
		}
		sPtr->flags.incrDown = 0;
		sPtr->flags.decrDown = 0;
		break;

	case ButtonPress:
		/* FIXME: change Mod1Mask with something else */
		if (sPtr->flags.documentFullyVisible)
			break;

		if (sPtr->flags.horizontal) {
			wheelDecrement = WINGsConfiguration.mouseWheelDown;
			wheelIncrement = WINGsConfiguration.mouseWheelUp;
		} else {
			wheelDecrement = WINGsConfiguration.mouseWheelUp;
			wheelIncrement = WINGsConfiguration.mouseWheelDown;
		}

		if (event->xbutton.button == wheelDecrement) {
			if (event->xbutton.state & ControlMask) {
				sPtr->flags.hitPart = WSDecrementPage;
			} else if (event->xbutton.state & ShiftMask) {
				sPtr->flags.hitPart = WSDecrementLine;
			} else {
				sPtr->flags.hitPart = WSDecrementWheel;
			}
			if (sPtr->action) {
				(*sPtr->action) (sPtr, sPtr->clientData);
				WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, NULL);
			}
		} else if (event->xbutton.button == wheelIncrement) {
			if (event->xbutton.state & ControlMask) {
				sPtr->flags.hitPart = WSIncrementPage;
			} else if (event->xbutton.state & ShiftMask) {
				sPtr->flags.hitPart = WSIncrementLine;
			} else {
				sPtr->flags.hitPart = WSIncrementWheel;
			}
			if (sPtr->action) {
				(*sPtr->action) (sPtr, sPtr->clientData);
				WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, NULL);
			}
		} else {
			handlePush(sPtr, event->xbutton.x, event->xbutton.y, (event->xbutton.state & Mod1Mask)
				   || event->xbutton.button == Button2);
			/* continue scrolling if pushed on the buttons */
			if (sPtr->flags.hitPart == WSIncrementLine || sPtr->flags.hitPart == WSDecrementLine) {
				sPtr->timerID = WMAddTimerHandler(AUTOSCROLL_INITIAL_DELAY, autoScroll, sPtr);
			}
		}
		break;

	case ButtonRelease:
		if (sPtr->flags.draggingKnob) {
			if (sPtr->action) {
				(*sPtr->action) (sPtr, sPtr->clientData);
				WMPostNotificationName(WMScrollerDidScrollNotification, sPtr, NULL);
			}
		}
		if (sPtr->timerID) {
			WMDeleteTimerHandler(sPtr->timerID);
			sPtr->timerID = NULL;
		}
		sPtr->flags.incrDown = 0;
		sPtr->flags.decrDown = 0;
		sPtr->flags.draggingKnob = 0;
		break;

	case MotionNotify:
		handleMotion(sPtr, event->xbutton.x, event->xbutton.y);
		if (sPtr->timerID && sPtr->flags.hitPart != WSIncrementLine
		    && sPtr->flags.hitPart != WSDecrementLine) {
			WMDeleteTimerHandler(sPtr->timerID);
			sPtr->timerID = NULL;
		}
		break;
	}
	if (id != sPtr->flags.incrDown || dd != sPtr->flags.decrDown)
		paintScroller(sPtr);
}