예제 #1
0
파일: atheos.cpp 프로젝트: Gingar/port
void LinksView::KeyDown(const char *s, const char *rs, uint32 q)
{
	int c;
	unsigned char *ss = q & (QUAL_CTRL | QUAL_ALT) ? (unsigned char *)rs : (unsigned char *)s;
	win->Unlock();
	ath_lock->Lock();
	win->Lock();
	GET_UTF_8(ss, c);
	switch (c) {
		case VK_BACKSPACE: c = KBD_BS; break;
		case VK_ENTER: c = KBD_ENTER; break;
		case VK_SPACE: c = ' '; break;
		case VK_TAB: c = KBD_TAB; break;
		case VK_ESCAPE: c = KBD_ESC; break;
		case VK_LEFT_ARROW: c = KBD_LEFT; break;
		case VK_RIGHT_ARROW: c = KBD_RIGHT; break;
		case VK_UP_ARROW: c = KBD_UP; break;
		case VK_DOWN_ARROW: c = KBD_DOWN; break;
		case VK_INSERT: c = KBD_INS; break;
		case VK_DELETE: c = KBD_DEL; break;
		case VK_HOME: c = KBD_HOME; break;
		case VK_END: c = KBD_END; break;
		case VK_PAGE_UP: c = KBD_PAGE_UP; break;
		case VK_PAGE_DOWN: c = KBD_PAGE_DOWN; break;
		default: if (c < 32) c = 0;
			 else q &= ~QUAL_SHIFT;
			 break;
	}
	if (c) if (dev) dev->keyboard_handler(dev, c, (q & QUAL_SHIFT ? KBD_SHIFT : 0) | (q & QUAL_CTRL ? KBD_CTRL : 0) | (q & QUAL_ALT ? KBD_ALT : 0));
	ath_lock->Unlock();
	write(wpipe, " ", 1);
	/*fprintf(stderr, "key: :%s: :%s: %d %d\n", s, rs, q, c);*/
}
예제 #2
0
파일: atheos.cpp 프로젝트: Gingar/port
struct graphics_device *ath_init_device()
{
	LinksView *view;
	LinksWindow *win;
	struct graphics_device *dev = (struct graphics_device *)mem_calloc(sizeof(struct graphics_device));
	if (!dev) return NULL;
	dev->drv = &atheos_driver;
	debug((unsigned char *)"1");
	win = new LinksWindow(Rect(ath_win_x_pos, ath_win_y_pos, ath_win_x_pos + ath_win_x_size, ath_win_y_pos + ath_win_y_size));
	debug((unsigned char *)"2");
	if (!win) {
		mem_free(dev);
		return NULL;
	}
	debug((unsigned char *)"3");
	view = new LinksView(win);
	if (!view) {
		delete win;
		mem_free(dev);
		return NULL;
	}
	view->dev = dev;
	dev->driver_data = view;
	ath_get_size(dev);
	memcpy(&dev->clip, &dev->size, sizeof(struct rect));
	debug((unsigned char *)"4");
	win->Show();
	win->MakeFocus();
	debug((unsigned char *)"5");
	return dev;
}
예제 #3
0
파일: atheos.cpp 프로젝트: Gingar/port
void ath_set_title(struct graphics_device *dev, unsigned char *title)
{
	LinksWindow *win = lv(dev)->win;
	lock_dev(dev);
	win->SetTitle((string)(char *)title);
	lv(dev)->d_flush();
	unlock_dev(dev);
}
예제 #4
0
파일: atheos.cpp 프로젝트: Gingar/port
void ath_shutdown_device(struct graphics_device *dev)
{
	LinksWindow *win = lv(dev)->win;
	unregister_bottom_half(do_flush, dev);
	lv(dev)->dev = NULL;
	win->PostMessage(M_TERMINATE);
	mem_free(dev);
}
예제 #5
0
파일: atheos.cpp 프로젝트: Gingar/port
void LinksView::MouseMove(const Point &p, int c, uint32 b, Message *m)
{
	win->Unlock();
	ath_lock->Lock();
	win->Lock();
	if (dev) dev->mouse_handler(dev, last_x = (int)p.x, last_y = (int)p.y, !b ? B_MOVE : B_DRAG | (b & 1 ? B_LEFT : b & 2 ? B_RIGHT : b & 4 ? B_MIDDLE : B_LEFT));
	ath_lock->Unlock();
	write(wpipe, " ", 1);
}
예제 #6
0
파일: atheos.cpp 프로젝트: Gingar/port
void LinksView::MouseUp(const Point &p, uint32 b, Message *m)
{
	win->Unlock();
	ath_lock->Lock();
	win->Lock();
	if (dev) dev->mouse_handler(dev, last_x = (int)p.x, last_y = (int)p.y, B_UP | (b == 2 ? B_RIGHT : b == 3 ? B_MIDDLE : B_LEFT));
	ath_lock->Unlock();
	write(wpipe, " ", 1);
}
예제 #7
0
파일: atheos.cpp 프로젝트: Gingar/port
void LinksView::WheelMove(const point &d)
{
	win->Unlock();
	ath_lock->Lock();
	win->Lock();
	if (d.y) if (dev) dev->mouse_handler(dev, last_x, last_y, B_MOVE | (d.y > 0 ? B_WHEELDOWN : B_WHEELUP));
	if (d.x) if (dev) dev->mouse_handler(dev, last_x, last_y, B_MOVE | (d.x < 0 ? B_WHEELLEFT : B_WHEELRIGHT));
	ath_lock->Unlock();
	write(wpipe, " ", 1);
}
예제 #8
0
struct graphics_device *ath_init_device()
{
	LinksView *view;
	LinksWindow *win;
	struct graphics_device *dev = (struct graphics_device *)mem_calloc(sizeof(struct graphics_device));
	if (!dev) return NULL;
	debug((unsigned char *)"1");
	retry:
	win = new LinksWindow(Rect(ath_win_x_pos, ath_win_y_pos, ath_win_x_pos + ath_win_x_size, ath_win_y_pos + ath_win_y_size));
	debug((unsigned char *)"2");
	if (!win) {
		if (out_of_memory(0, NULL, 0))
			goto retry;
		mem_free(dev);
		return NULL;
	}
	debug((unsigned char *)"3");
	retry2:
	view = new LinksView(win);
	if (!view) {
		if (out_of_memory(0, NULL, 0))
			goto retry2;
		delete win;
		mem_free(dev);
		return NULL;
	}
	view->dev = dev;
	dev->driver_data = view;
	ath_get_size(dev);
	memcpy(&dev->clip, &dev->size, sizeof(struct rect));
	debug((unsigned char *)"4");
	win->Show();
	win->MakeFocus();
	debug((unsigned char *)"5");

	ath_win_x_pos += NEW_WINDOW_X_ADD;
	ath_win_y_pos += NEW_WINDOW_Y_ADD;
	if (ath_win_x_pos + ath_win_x_size > ath_x_size - NEW_WINDOW_X_MIN)
		ath_win_x_pos = NEW_WINDOW_X_MIN;
	if (ath_win_y_pos + ath_win_y_size > ath_y_size - NEW_WINDOW_Y_MIN)
		ath_win_y_pos = ath_y_panel + NEW_WINDOW_Y_MIN;

	return dev;
}
예제 #9
0
파일: atheos.cpp 프로젝트: Gingar/port
void LinksView::Paint(const Rect &r)
{
	struct rect rr;
	win->Unlock();
	ath_lock->Lock();
	win->Lock();
	rr.x1 = (int)r.left;
	rr.x2 = (int)r.right + 1;
	rr.y1 = (int)r.top;
	rr.y2 = (int)r.bottom + 1;
	/*fprintf(stderr, "paint: %d %d %d %d\n", rr.x1, rr.x2, rr.y1, rr.y2);*/
	if (dev) {
		if (!win->resized) dev->redraw_handler(dev, &rr);
		else {
			ath_get_size(dev);
			win->resized = 0;
			dev->resize_handler(dev);
		}
	}
	check_bottom_halves();
	ath_lock->Unlock();
	write(wpipe, " ", 1);
}