static int lWindowShouldClose(lua_State *L) { GLFWwindow * window = getwindow(L); lua_pushboolean(L, glfwWindowShouldClose(window)); return 1; }
void resize(void) { Rectangle old, r; int dxo, dyo, dxn, dyn; Win *w; old = screen->r; dxo = Dx(old); dyo = Dy(old); if(getwindow(display, Refnone) < 0) sysfatal("resize failed: %r"); dxn = Dx(screen->r); dyn = Dy(screen->r); freescreen(scr); scr = allocscreen(screen, display->white, 0); if(scr == nil) sysfatal("allocscreen: %r"); for(w = wlist.next; w != &wlist; w = w->next){ r = rectsubpt(w->entire, old.min); r.min.x = muldiv(r.min.x, dxn, dxo); r.max.x = muldiv(r.max.x, dxn, dxo); r.min.y = muldiv(r.min.y, dyn, dyo); r.max.y = muldiv(r.max.y, dyn, dyo); w->entire = rectaddpt(r, screen->r.min); w->inner = insetrect(w->entire, BORDSIZ); freeimage(w->im); w->im = allocwindow(scr, w->entire, Refbackup, 0); if(w->im == nil) sysfatal("allocwindow: %r"); draw(w->im, w->inner, w->tab->cols[BACK], nil, ZP); border(w->im, w->entire, BORDSIZ, w->tab->cols[w == actw ? BORD : DISB], ZP); w->tab->draw(w); } }
static int lSwapBuffers(lua_State *L) { GLFWwindow * window = getwindow(L); glfwSwapBuffers(window); return 0; }
static int lDestroyWindow(lua_State *L) { GLFWwindow * window = getwindow(L); glfwDestroyWindow(window); return 0; }
void xmms_fullscreen_leave(GtkWidget * win) { fullscreen_window_t *fwin; FULL_LOCK(); fwin = getwindow(win); if (fwin->is_full && fwin->display->is_full) { /* Release our grabs */ gdk_pointer_ungrab(GDK_CURRENT_TIME); gdk_keyboard_ungrab(GDK_CURRENT_TIME); /* Let the WM manage this window again */ gdk_window_hide(fwin->window->window); gdk_window_set_override_redirect(fwin->window->window, FALSE); gdk_window_show(fwin->window->window); /* Restore size/position */ gdk_window_move_resize(fwin->window->window, fwin->ox, fwin->oy, fwin->owidth, fwin->oheight); XF86VidModeSwitchToMode(fwin->display->display, DefaultScreen(fwin->display->display), fwin->display->origmode); fwin->display->is_full = FALSE; } fwin->is_full = FALSE; FULL_UNLOCK(); }
/* Retrieve pending events, and return the number of events */ static int getPendingEvents(void) { int count = 0; while (1) { Mouse mouse; Rune rune; int charCode, modifiers; int mouse_event = nbrecv(mousectl->c, (void*)&mouse); int resize_event = nbrecv(mousectl->resizec, NULL); int kbd_event = nbrecv(keyboardctl->c, (void*)&rune); if (mouse_event) { //Process mouse event mouse_position.x = mouse.xy.x - screen->r.min.x; mouse_position.y = mouse.xy.y - screen->r.min.y; mouse_button_state = mouse.buttons; qlock(&evt_buf_lock); if ((evts_end+2)%EVT_BUFFER_SIZE != evts_start) { sqMouseEvent* evt = (sqMouseEvent*)&evts[evts_end++]; evts_end %= EVT_BUFFER_SIZE; evt->type = EventTypeMouse; evt->timeStamp = ioMSecs(); evt->x = mouse_position.x; evt->y = mouse_position.y; evt->buttons = ioGetButtonState(); evt->modifiers = 0; evt->reserved1 = evt->windowIndex = 0; count++; } qunlock(&evt_buf_lock); } if (resize_event) { getwindow(display, Refnone); fullDisplayUpdate(); } if (kbd_event && splitRune(rune, &charCode, &modifiers)) { //Process keyboard event qlock(&evt_buf_lock); if ((evts_end+2)%EVT_BUFFER_SIZE != evts_start) { sqKeyboardEvent* evt = (sqKeyboardEvent*)&evts[evts_end++]; evts_end %= EVT_BUFFER_SIZE; evt->type = EventTypeKeyboard; evt->timeStamp = ioMSecs(); evt->pressCode = EventKeyChar; evt->charCode = charCode; evt->modifiers = modifiers; evt->reserved1 = evt->windowIndex = 0; count++; } qunlock(&evt_buf_lock); } if (!(resize_event || kbd_event || mouse_event)) break; } return count; }
gboolean xmms_fullscreen_init(GtkWidget * win) { int event_base, error_base, dummy; fullscreen_window_t *fwin; gint i; XF86VidModeModeLine origmode; FULL_LOCK(); fwin = getwindow(win); if (!XF86VidModeQueryExtension (fwin->display->display, &event_base, &error_base)) { FULL_UNLOCK(); return FALSE; } if (!fwin->display->modes) { XF86VidModeGetAllModeLines(fwin->display->display, DefaultScreen(fwin->display->display), &fwin->display->num_modes, &fwin->display->modes); if (!fwin->display->origmode) { XF86VidModeGetModeLine(fwin->display->display, DefaultScreen(fwin->display->display), &dummy, &origmode); for (i = 0; i < fwin->display->num_modes; i++) { if (fwin->display->modes[i]->hdisplay == origmode.hdisplay && fwin->display->modes[i]->vdisplay == origmode.vdisplay) { fwin->display->origmode = fwin->display->modes[i]; break; } } if (!fwin->display->origmode) { fprintf(stderr, "ERROR: Could not determine original mode.\n"); FULL_UNLOCK(); return FALSE; } } fwin->display->can_full = (fwin->display->num_modes > 1); } FULL_UNLOCK(); return fwin->display->can_full; }
static int lMakeContextCurrent(lua_State *L) { GLFWwindow * window = getwindow(L); glfwMakeContextCurrent(window); if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress)) { return luaL_error(L, "Can't load GL"); } return 0; }
gboolean xmms_fullscreen_in(GtkWidget * win) { fullscreen_window_t *fwin; FULL_LOCK(); fwin = getwindow(win); FULL_UNLOCK(); if (fwin->display->is_full) return TRUE; else return FALSE; }
void resizethread(void *v) { USED(v); while(recv(mc->resizec, 0) == 1){ lockdisplay(display); if(getwindow(display, Refnone) < 0) sysfatal("attach to window: %r"); resize(); unlockdisplay(display); } }
void xmms_fullscreen_unmark(GtkWidget * win) { fullscreen_window_t *fwin; FULL_LOCK(); fwin = getwindow(win); if (fwin->is_full) { fwin->is_full = FALSE; fwin->display->is_full = FALSE; } FULL_UNLOCK(); }
/* called from graphics library */ void eresized(int callgetwin) { needresize = callgetwin + 1; /* new window? */ /* was using Refmesg */ if (needresize > 1 && getwindow(display, Refnone) < 0) sysfatal("can't reattach to window: %r"); /* destroyed window? */ if (Dx(screen->r) == 0 || Dy(screen->r) == 0) exits("window gone"); reshape(); }
static WINDOW * create_my_derwin(WINDOW *parent) { PAIR ul, lr; WINDOW *result = 0; if (getwindow(parent, &ul, &lr)) { result = derwin(parent, lines_of(ul, lr), cols_of(ul, lr), pair_of(ul)); if (result != 0) { fill_window(result, 'd'); add_window(parent, result); } } if (result == 0) result = parent; return result; }
static WINDOW * create_my_window(WINDOW *current) { PAIR ul, lr; WINDOW *result = 0; if (getwindow(stdscr, &ul, &lr)) { result = newwin(lines_of(ul, lr), cols_of(ul, lr), pair_of(ul)); if (result != 0) { fill_window(result, 'c'); add_window(stdscr, result); } } if (result == 0) result = current; return result; }
struct CACHE *viocmanager(struct CACHE * cacheobj) { register struct VIOC *vioc = (struct VIOC *) cacheobj; if (vioc->cache.status & CACHE_MODIFIED) { register int length = VIOC_CHUNKSIZE; register struct FCB *fcb = vioc->fcb; register unsigned base = vioc->cache.keyval; register char *address = (char *) vioc->data; printf("\nviocmanager writing vbn %d\n",base); cachetouch(&fcb->cache); do { register unsigned sts; unsigned rvn,mapblk,maplen; register struct VCBDEV *vcbdev; if (fcb->highwater > 0 && base >= fcb->highwater) break; sts = getwindow(fcb,base,&rvn,&mapblk,&maplen); if (sts & 1) { if (maplen > (unsigned)length) maplen = length; if (fcb->highwater > 0 && base + maplen > fcb->highwater) { maplen = fcb->head->fh2$l_highwater - base; } if (rvn > fcb->vcb->devices) { sts = SS$_NOSUCHFILE; } else { if (rvn < 2) { vcbdev = fcb->vcb->vcbdev; } else { vcbdev = &fcb->vcb->vcbdev[rvn - 1]; } if (vcbdev->dev == NULL) return NULL; sts = phyio_write(vcbdev->dev->handle,mapblk,maplen * 512,address); } } if ((sts & 1) == 0) { return NULL; } length -= maplen; base += maplen; address += maplen * 512; } while (length > 0); cacheuntouch(&fcb->cache,1,0); cacheobj->status &= ~CACHE_MODIFIED; } return cacheobj; }
gboolean xmms_fullscreen_mark(GtkWidget * win) { fullscreen_window_t *fwin; FULL_LOCK(); fwin = getwindow(win); if (fwin->display->is_full) { FULL_UNLOCK(); return FALSE; } else { fwin->is_full = TRUE; fwin->display->is_full = TRUE; FULL_UNLOCK(); return TRUE; } }
GSList *xmms_fullscreen_modelist(GtkWidget * win) { fullscreen_window_t *fwin; xmms_fullscreen_mode_t *ent; GSList *retlist = NULL; int i; FULL_LOCK(); fwin = getwindow(win); for (i = 0; i < fwin->display->num_modes; i++) { ent = g_malloc(sizeof (*ent)); ent->width = fwin->display->modes[i]->hdisplay; ent->height = fwin->display->modes[i]->vdisplay; retlist = g_slist_append(retlist, ent); } FULL_UNLOCK(); return retlist; }
static WINDOW * create_my_subwin(WINDOW *parent) { PAIR ul, lr; WINDOW *result = 0; if (getwindow(parent, &ul, &lr)) { result = subwin(parent, lines_of(ul, lr), cols_of(ul, lr), ul.y + getbegy(parent), ul.x + getbegx(parent)); if (result != 0) { fill_window(result, 's'); add_window(parent, result); } } if (result == 0) result = parent; return result; }
static void resize(Vnc *v, int first) { int fd; Point d; d = addpt(v->dim, Pt(2*Borderwidth, 2*Borderwidth)); lockdisplay(display); if(getwindow(display, Refnone) < 0) sysfatal("internal error: can't get the window image"); /* * limit the window to at most the vnc server's size */ if(first || d.x < Dx(screen->r) || d.y < Dy(screen->r)) { fd = open("/dev/wctl", OWRITE); if(fd >= 0) { fprint(fd, "resize -dx %d -dy %d", d.x, d.y); close(fd); } } unlockdisplay(display); }
unsigned deallocfile(struct FCB *fcb) { register unsigned sts = 1; /* First mark all file clusters as free in BITMAP.SYS */ register unsigned vbn = 1; while (vbn <= fcb->hiblock) { register unsigned sts; unsigned rvn,mapblk,maplen; register struct VCBDEV *vcbdev; sts = getwindow(fcb,vbn,&rvn,&mapblk,&maplen); if ((sts & 1) == 0) break; if (rvn > fcb->vcb->devices) break; if (rvn < 2) { vcbdev = fcb->vcb->vcbdev; } else { vcbdev = &fcb->vcb->vcbdev[rvn - 1]; } if (vcbdev->dev == NULL) { break; } else { unsigned *bitmap,blkcount,modmask; struct VIOC *vioc; register unsigned clustersz = vcbdev->home.hm2$w_cluster; register unsigned clusterno = mapblk / clustersz; sts = accesschunk(vcbdev->mapfcb,clusterno / 4096 + 2, &vioc,(char **) &bitmap,&blkcount,1,&modmask); if (sts & 1) { register unsigned wordno = (clusterno % 4096) / (sizeof(unsigned) * 8); register unsigned bitno = clusterno % (sizeof(unsigned) * 8); do { register unsigned mask = 1 << bitno; vbn += clustersz; maplen -= clustersz; while (maplen > 0 && ++bitno < (sizeof(unsigned) * 8)) { mask |= (mask << 1); vbn += clustersz; maplen -= clustersz; } bitmap[wordno++] |= mask; bitno = 0; } while (maplen > 0 && wordno < blkcount / (sizeof(unsigned) * 8)); sts = deaccesschunk(vioc,modmask,1); } } } /* Now reset file header bit map in INDEXF.SYS and update each of the file headers... */ { unsigned rvn = fcb->rvn; unsigned modmask = fcb->modmask; struct HEAD *head = fcb->head; struct VIOC *headvioc = fcb->headvioc; do { struct fiddef extfid; register struct VCBDEV *vcbdev; if (rvn > fcb->vcb->devices) break; if (rvn < 2) { vcbdev = fcb->vcb->vcbdev; } else { vcbdev = &fcb->vcb->vcbdev[rvn - 1]; } if (vcbdev->dev == NULL) { break; } else { unsigned *bitmap,viocmask; struct VIOC *vioc; register unsigned fileno = (head->fh2$w_fid.fid$b_nmx << 16) + head->fh2$w_fid.fid$w_num - 1; register unsigned idxblk = fileno / 4096 + vcbdev->home.hm2$w_cluster * 4 + 1; sts = accesschunk(vcbdev->idxfcb,idxblk,&vioc, (char **) &bitmap,NULL,1,&viocmask); if (sts & 1) { bitmap[(fileno % 4096) / (sizeof(unsigned) * 8)] &= ~(1 << (fileno % (sizeof(unsigned) * 8))); sts = deaccesschunk(vioc,viocmask,1); } else { break; } } head->fh2$w_fid.fid$w_num = 0; head->fh2$w_fid.fid$b_rvn = 0; head->fh2$w_fid.fid$b_nmx = 0; head->fh2$w_checksum = 0; memcpy(&extfid,&fcb->head->fh2$w_ext_fid,sizeof(struct fiddef)); sts = deaccesshead(headvioc,head,modmask); if ((sts & 1) == 0) break; if (extfid.fid$b_rvn == 0) { extfid.fid$b_rvn = rvn; } else { rvn = extfid.fid$b_rvn; } if (extfid.fid$w_num != 0 || extfid.fid$b_nmx != 0) { sts = accesshead(fcb->vcb,&extfid,&headvioc,&head,&modmask,1); if ((sts & 1) == 0) break; } else { break; } } while (1); if (sts & 1) { fcb->headvioc = NULL; cacheuntouch(&fcb->cache,0,1); cachedelete(&fcb->cache); } } return sts; }
unsigned accesschunk(struct FCB *fcb,unsigned vbn,struct VIOC **retvioc, char **retbuff,unsigned *retblocks,unsigned wrtblks, unsigned *retmodmask) { /* First find cache entry... */ register struct VIOC *vioc; unsigned create = sizeof(struct VIOC); register unsigned base = (vbn - 1) / VIOC_CHUNKSIZE * VIOC_CHUNKSIZE + 1; #ifdef DEBUG printf("Access chunk %8x %d (%x)\n",base,vbn,fcb->cache.keyval); #endif if (wrtblks && ((fcb->cache.status & CACHE_WRITE) == 0)) return SS$_WRITLCK; if (vbn < 1 || vbn > fcb->hiblock) return SS$_ENDOFFILE; vioc = cachesearch((void *) &fcb->vioc,base,0,NULL,NULL,&create); if (vioc == NULL) return SS$_INSFMEM; /* If not found make one... */ if (create == 0) { register unsigned length; register char *address; register unsigned mapbase = base; vioc->cache.status |= 0x400; /* For debugging! */ vioc->fcb = fcb; vioc->wrtmask = 0; vioc->modmask = 0; length = fcb->hiblock - mapbase + 1; if (length > VIOC_CHUNKSIZE) length = VIOC_CHUNKSIZE; address = (char *) vioc->data; do { if (fcb->highwater > 0 && mapbase >= fcb->highwater) { memset(address,0,length * 512); length = 0; } else { register unsigned sts; unsigned rvn,mapblk,maplen; register struct VCBDEV *vcbdev; sts = getwindow(fcb,mapbase,&rvn,&mapblk,&maplen); if (sts & 1) { if (maplen > length) maplen = length; if (fcb->highwater > 0 && mapbase + maplen > fcb->highwater) { maplen = fcb->head->fh2$l_highwater - mapbase; } if (rvn > fcb->vcb->devices) { sts = SS$_NOSUCHFILE; } else { if (rvn < 2) { vcbdev = fcb->vcb->vcbdev; } else { vcbdev = &fcb->vcb->vcbdev[rvn - 1]; } if (vcbdev->dev == NULL) return SS$_NOSUCHFILE; sts = phyio_read(vcbdev->dev->handle,mapblk,maplen * 512,address); } } if ((sts & 1) == 0) { cacheuntouch(&vioc->cache,0,0); cachefree(&vioc->cache); return sts; } length -= maplen; mapbase += maplen; address += maplen * 512; } } while (length > 0); } if (wrtblks) { vioc->cache.status |= CACHE_WRITE; vioc->cache.objmanager = viocmanager; } /* Return result to caller... */ *retvioc = vioc; *retbuff = vioc->data[vbn - base]; if (wrtblks || retblocks != NULL || retmodmask != NULL) { register unsigned modmask = 0; register unsigned blocks = base + VIOC_CHUNKSIZE - vbn; if (blocks > fcb->hiblock - vbn) blocks = fcb->hiblock - vbn + 1; if (wrtblks) if (blocks > wrtblks) blocks = wrtblks; if (retblocks != NULL) *retblocks = blocks; if (wrtblks) { modmask = 1 << (vbn - base); if (blocks > 1) { while (--blocks > 0) modmask |= modmask << 1; } vioc->wrtmask |= modmask; } if (retmodmask != NULL) *retmodmask = modmask; } return SS$_NORMAL; }
void mousethread(void *v) { Text *t, *argt; int but; uint q0, q1; Window *w; Plumbmsg *pm; Mouse m; char *act; enum { MResize, MMouse, MPlumb, MWarnings, NMALT }; static Alt alts[NMALT+1]; USED(v); threadsetname("mousethread"); alts[MResize].c = mousectl->resizec; alts[MResize].v = nil; alts[MResize].op = CHANRCV; alts[MMouse].c = mousectl->c; alts[MMouse].v = &mousectl->m; alts[MMouse].op = CHANRCV; alts[MPlumb].c = cplumb; alts[MPlumb].v = ± alts[MPlumb].op = CHANRCV; alts[MWarnings].c = cwarn; alts[MWarnings].v = nil; alts[MWarnings].op = CHANRCV; if(cplumb == nil) alts[MPlumb].op = CHANNOP; alts[NMALT].op = CHANEND; for(;;){ qlock(&row.lk); flushwarnings(); qunlock(&row.lk); flushimage(display, 1); switch(alt(alts)){ case MResize: if(getwindow(display, Refnone) < 0) error("attach to window"); draw(screen, screen->r, display->white, nil, ZP); iconinit(); scrlresize(); rowresize(&row, screen->clipr); break; case MPlumb: if(strcmp(pm->type, "text") == 0){ act = plumblookup(pm->attr, "action"); if(act==nil || strcmp(act, "showfile")==0) plumblook(pm); else if(strcmp(act, "showdata")==0) plumbshow(pm); } plumbfree(pm); break; case MWarnings: break; case MMouse: /* * Make a copy so decisions are consistent; mousectl changes * underfoot. Can't just receive into m because this introduces * another race; see /sys/src/libdraw/mouse.c. */ m = mousectl->m; qlock(&row.lk); t = rowwhich(&row, m.xy); if(t!=mousetext && mousetext!=nil && mousetext->w!=nil){ winlock(mousetext->w, 'M'); mousetext->eq0 = ~0; wincommit(mousetext->w, mousetext); winunlock(mousetext->w); } mousetext = t; if(t == nil) goto Continue; w = t->w; if(t==nil || m.buttons==0) goto Continue; but = 0; if(m.buttons == 1) but = 1; else if(m.buttons == 2) but = 2; else if(m.buttons == 4) but = 3; barttext = t; if(t->what==Body && ptinrect(m.xy, t->scrollr)){ if(but){ if(swapscrollbuttons){ if(but == 1) but = 3; else if(but == 3) but = 1; } winlock(w, 'M'); t->eq0 = ~0; textscroll(t, but); winunlock(w); } goto Continue; } /* scroll buttons, wheels, etc. */ if(w != nil && (m.buttons & (8|16))){ if(m.buttons & 8) but = Kscrolloneup; else but = Kscrollonedown; winlock(w, 'M'); t->eq0 = ~0; texttype(t, but); winunlock(w); goto Continue; } if(ptinrect(m.xy, t->scrollr)){ if(but){ if(t->what == Columntag) rowdragcol(&row, t->col, but); else if(t->what == Tag){ coldragwin(t->col, t->w, but); if(t->w) barttext = &t->w->body; } if(t->col) activecol = t->col; } goto Continue; } if(m.buttons){ if(w) winlock(w, 'M'); t->eq0 = ~0; if(w) wincommit(w, t); else textcommit(t, TRUE); if(m.buttons & 1){ textselect(t); if(w) winsettag(w); argtext = t; seltext = t; if(t->col) activecol = t->col; /* button 1 only */ if(t->w!=nil && t==&t->w->body) activewin = t->w; }else if(m.buttons & 2){ if(textselect2(t, &q0, &q1, &argt)) execute(t, q0, q1, FALSE, argt); }else if(m.buttons & 4){ if(textselect3(t, &q0, &q1)) look3(t, q0, q1, FALSE); } if(w) winunlock(w); goto Continue; } Continue: qunlock(&row.lk); break; } } }
void mousethread(void *) { Plumbmsg *pm; Mouse m; Text *t; int but; enum { MResize, MMouse, MPlumb, MRefresh, NMALT }; static Alt alts[NMALT+1]; threadsetname("mousethread"); alts[MResize].c = mousectl->resizec; alts[MResize].v = nil; alts[MResize].op = CHANRCV; alts[MMouse].c = mousectl->c; alts[MMouse].v = &mousectl->Mouse; alts[MMouse].op = CHANRCV; alts[MPlumb].c = cplumb; alts[MPlumb].v = ± alts[MPlumb].op = CHANRCV; alts[MRefresh].c = crefresh; alts[MRefresh].v = nil; alts[MRefresh].op = CHANRCV; if(cplumb == nil) alts[MPlumb].op = CHANNOP; alts[NMALT].op = CHANEND; for(;;){ qlock(&row); flushrefresh(); qunlock(&row); flushimage(display, 1); switch(alt(alts)){ case MResize: if(getwindow(display, Refnone) < 0) error("resized"); scrlresize(); tmpresize(); rowresize(&row, screen->clipr); break; case MPlumb: plumblook(pm); plumbfree(pm); break; case MRefresh: break; case MMouse: m = mousectl->Mouse; if(m.buttons == 0) continue; qlock(&row); but = 0; if(m.buttons == 1) but = 1; else if(m.buttons == 2) but = 2; else if(m.buttons == 4) but = 3; if(m.buttons & (8|16)){ if(m.buttons & 8) but = Kscrolloneup; else but = Kscrollonedown; rowwhich(&row, m.xy, but, TRUE); }else if(but){ t = rowwhich(&row, m.xy, but, FALSE); if(t) textmouse(t, m.xy, but); } qunlock(&row); break; } } }
gboolean xmms_fullscreen_enter(GtkWidget * win, gint * w, gint * h) { gint i, close, how_close = -1, t, dummy; gboolean retval = FALSE; fullscreen_window_t *fwin; FULL_LOCK(); fwin = getwindow(win); if (!fwin->display->is_full && !fwin->is_full && fwin->display->can_full) { for (close = 0; close < fwin->display->num_modes; close++) { if ((fwin->display->modes[close]->hdisplay >= *w) && (fwin->display->modes[close]->vdisplay >= *h)) { how_close = fwin->display->modes[close]->hdisplay - *w; break; } } for (i = close + 1; i < fwin->display->num_modes; i++) { if (fwin->display->modes[i]->vdisplay < *h) continue; t = fwin->display->modes[i]->hdisplay - *w; if (t >= 0 && t < how_close) { close = i; how_close = t; } } if (close < fwin->display->num_modes) { *w = fwin->display->modes[close]->hdisplay; *h = fwin->display->modes[close]->vdisplay; /* Save the old position/size */ gdk_window_get_root_origin(fwin->window->window, &fwin->ox, &fwin->oy); gdk_window_get_size(fwin->window->window, &fwin->owidth, &fwin->oheight); /* Move it. */ gdk_window_move_resize(fwin->window->window, 0, 0, fwin->display->modes[close]->hdisplay, fwin->display->modes[close]->vdisplay); /* Tell the WM not to mess with this window (no more decor) */ gdk_window_hide(fwin->window->window); gdk_window_set_override_redirect(fwin->window->window, TRUE); gdk_window_show(fwin->window->window); /* * XXX: HACK * Something is ungrabbing the pointer shortly * after the above unmap/override_redirect=TRUE/map * is done. I don't know what at this time, only * that it's not XMMS, and that it's very very evil. */ gdk_flush(); xmms_usleep(50000); /* Steal the keyboard/mouse */ /* XXX: FIXME, use timeouts.. */ for (t = 0; t < 10; t++) { dummy = gdk_pointer_grab(fwin->window->window, TRUE, 0, fwin->window->window, NULL, GDK_CURRENT_TIME); if (dummy == GrabSuccess) break; gtk_main_iteration_do(FALSE); xmms_usleep(10000); } gdk_keyboard_grab(fwin->window->window, TRUE, GDK_CURRENT_TIME); /* Do the video mode switch.. */ XF86VidModeSwitchToMode(fwin->display->display, DefaultScreen(fwin->display->display), fwin->display->modes[close]); XF86VidModeSetViewPort(fwin->display->display, DefaultScreen(fwin->display->display), 0, 0); retval = TRUE; fwin->is_full = TRUE; fwin->display->is_full = TRUE; } } FULL_UNLOCK(); return retval; }