Exemple #1
0
static void lxynth_shutdown_driver (void)
{
	DEBUGF ("%s (%s:%d)\n", __FUNCTION__, __FILE__, __LINE__);

        if (lxynth_root->running) {
		lxynth_root->running = 0;
		s_window_quit(lxynth_root->window);
		s_thread_join(lxynth_root->tid, NULL);
		kill_timer(lxynth_root->timerid);
	}

	while (!s_list_eol(lxynth_root->eventq->list, 0)) {
		s_event_t *event = s_list_get(lxynth_root->eventq->list, 0);
		s_list_remove(lxynth_root->eventq->list, 0);
		s_event_uninit(event);
	}
	s_free(lxynth_root->eventq->list);
	s_thread_mutex_destroy(lxynth_root->eventq->mut);
	s_free(lxynth_root->eventq);

	while (!s_list_eol(lxynth_root->gd->list, 0)) {
		struct graphics_device *gd = s_list_get(lxynth_root->gd->list, 0);
		lxynth_device_t *wd = (lxynth_device_t *) gd->driver_data;
		s_list_remove(lxynth_root->gd->list, 0);
		s_free(wd->title);
		s_surface_destroy(wd->surface);
		s_free(wd);
		s_free(gd);
	}
	s_free(lxynth_root->gd->list);
	s_thread_mutex_destroy(lxynth_root->gd->mut);
	s_free(lxynth_root->gd);

	s_free(lxynth_root);
}
Exemple #2
0
void taskbar_clock_handler_oh (s_window_t *window, s_event_t *event, s_handler_t *handler)
{
        tbar_data_t *tbar_data;
        tbar_clock_t *tbar_clock;
	tbar_data = (tbar_data_t *) window->data;
	tbar_clock = tbar_data->tbar_clock;
	if (tbar_clock->clock == NULL) {
		return;
	}
	s_window_quit(tbar_clock->clock);
}
Exemple #3
0
void taskbar_clock_popup_atevent (s_window_t *window, s_event_t *event)
{
	int x;
	int y;
	tbar_data_t *tbar_data;
	tbar_clock_t *tbar_clock;
	if (event->type & EVENT_TYPE_MOUSE) {
		tbar_data = (tbar_data_t *) window->parent->data;
		tbar_clock = (tbar_clock_t *) tbar_data->tbar_clock;
		x = event->mouse->x - window->parent->surface->buf->x;
		y = event->mouse->y - window->parent->surface->buf->y;
		if (!((x >= tbar_clock->rect.x) &&
		      (y >= tbar_clock->rect.y) &&
		      (x <= (tbar_clock->rect.x + tbar_clock->rect.w - 1)) &&
		      (y <= (tbar_clock->rect.y + tbar_clock->rect.h - 1)))) {
			s_window_quit(window);
		}
	}
}
Exemple #4
0
/**
 * \brief Timer event handler
 *
 * Given virtual function is called by the parent window whenever a timer is
 * fired. In the context of effect-enabled windows, the timer is used to
 * implement window slide-in and slide-out animations.
 *
 * \param idTimer Specifies the timer identifier
 */
void GuiEffectWindow::onTimer(int idTimer)
{
	s_thread_mutex_lock(effectMutex);

	// check if we have a stale timer event
	if(effectTimer == NULL)
	{
		#ifdef DEBUG
		printf("stale timer %d\n", idTimer);
		#endif
		s_thread_mutex_unlock(effectMutex);
		return;
	}

	#ifdef DEBUG
	printf("GuiEffectWindow::onTimer: %d locked\n", idTimer);
	#endif

	switch(idTimer)
	{
	case OPEN_EFFECT_SLIDE_BOTTOM:

		if(windowPos.y >= originalPos.y)
		{
			stopTimer(effectTimer);
			effectTimer = NULL;
			break;
		}

		windowPos.y += originalPos.y - windowPos.y < effectVertSpeed ?
				originalPos.y - windowPos.y : effectVertSpeed;

		if(windowPos.y >= originalPos.y)
			refreshRealSurface = true;

		setWindowPos(windowPos);
		break;

	case OPEN_EFFECT_SLIDE_RIGHT:

		if(windowPos.x >= originalPos.x)
		{
			stopTimer(effectTimer);
			effectTimer = NULL;
			break;
		}

		windowPos.x += originalPos.x - windowPos.x < effectHorzSpeed ?
				originalPos.x - windowPos.x : effectHorzSpeed;

		if(windowPos.x >= originalPos.x)
			refreshRealSurface = true;


		#ifdef DEBUG
		printf("GuiEffectWindow::onTimer: open %d %d %d %d\n",
				windowPos.x, windowPos.y, windowPos.w, windowPos.h);
		#endif
		setWindowPos(windowPos);
		break;

	case OPEN_EFFECT_SLIDE_TOP:

		if(windowPos.y <= originalPos.y)
		{
			stopTimer(effectTimer);
			effectTimer = NULL;
			break;
		}

		windowPos.y -= windowPos.y - originalPos.y < effectVertSpeed ?
				windowPos.y - originalPos.y : effectVertSpeed;

		if(windowPos.y <= originalPos.y)
			refreshRealSurface = true;

		setWindowPos(windowPos);
		break;

	case OPEN_EFFECT_SLIDE_LEFT:

		if(windowPos.x <= originalPos.x)
		{
			stopTimer(effectTimer);
			effectTimer = NULL;
			break;
		}

		windowPos.x -= windowPos.x - originalPos.x < effectHorzSpeed ?
				windowPos.x - originalPos.x : effectHorzSpeed;

		if(windowPos.x <= originalPos.x)
			refreshRealSurface = true;

		setWindowPos(windowPos);
		break;

	case CLOSE_EFFECT_SLIDE_BOTTOM:

		if(windowPos.y >= wndHandle->surface->height)
		{
			stopTimer(effectTimer);
			effectTimer = NULL;

			if(showWindowType == HIDE_WINDOW)
			{
				s_window_hide(wndHandle);
			}
			else if(showWindowType == CLOSE_WINDOW)
			{
				returnCode = closeRetCode;
				isShuttingDown = true;
				s_window_quit(wndHandle);
			}
			break;
		}

		windowPos.y += effectVertSpeed;
		setWindowPos(windowPos);
		break;

	case CLOSE_EFFECT_SLIDE_RIGHT:

		if(windowPos.x >= wndHandle->surface->width)
		{
			stopTimer(effectTimer);
			effectTimer = NULL;

			if(showWindowType == HIDE_WINDOW)
			{
				s_window_hide(wndHandle);
			}
			else if(showWindowType == CLOSE_WINDOW)
			{
				returnCode = closeRetCode;
				isShuttingDown = true;
				s_window_quit(wndHandle);
			}
			break;
		}

		windowPos.x += effectHorzSpeed;

		#ifdef DEBUG
		printf("GuiEffectWindow::onTimer: close %d %d %d %d\n",
				windowPos.x, windowPos.y, windowPos.w, windowPos.h);
		#endif

		setWindowPos(windowPos);
		break;

	case CLOSE_EFFECT_SLIDE_TOP:

		if(windowPos.y + windowPos.h <= 0)
		{
			stopTimer(effectTimer);
			effectTimer = NULL;

			if(showWindowType == HIDE_WINDOW)
			{
				s_window_hide(wndHandle);
			}
			else if(showWindowType == CLOSE_WINDOW)
			{
				returnCode = closeRetCode;
				isShuttingDown = true;
				s_window_quit(wndHandle);
			}
			break;
		}

		windowPos.y -= effectVertSpeed;
		setWindowPos(windowPos);
		break;

	case CLOSE_EFFECT_SLIDE_LEFT:

		if(windowPos.x + windowPos.w <= 0)
		{
			stopTimer(effectTimer);
			effectTimer = NULL;

			if(showWindowType == HIDE_WINDOW)
			{
				s_window_hide(wndHandle);
			}
			else if(showWindowType == CLOSE_WINDOW)
			{
				returnCode = closeRetCode;
				isShuttingDown = true;
				s_window_quit(wndHandle);
			}
			break;
		}

		windowPos.x -= effectHorzSpeed;
		setWindowPos(windowPos);
		break;
	}

	s_thread_mutex_unlock(effectMutex);
	#ifdef DEBUG
	printf("GuiEffectWindow::onTimer: %d unlocked\n", idTimer);
	#endif
}
Exemple #5
0
static void xynthlogout_cancel (s_window_t *window, s_event_t *event, s_handler_t *handler)
{
	s_window_quit(window);
}