本文整理汇总了C++中IDirectFBWindow::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFBWindow::GetSize方法的具体用法?C++ IDirectFBWindow::GetSize怎么用?C++ IDirectFBWindow::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFBWindow
的用法示例。
在下文中一共展示了IDirectFBWindow::GetSize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
DFBResult
DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch)
{
SDL_DFB_WINDOWDATA(window);
IDirectFBWindow *dfbwin = windata->dfbwin;
SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, cw, ch));
dfbwin->GetSize(dfbwin, cw, ch);
*cw -= windata->theme.left_size + windata->theme.right_size;
*ch -=
windata->theme.top_size + windata->theme.caption_size +
windata->theme.bottom_size;
return DFB_OK;
}
示例2: Java_vdr_mhp_awt_DFBWindowPeer_createDFBWindow
jlong Java_vdr_mhp_awt_DFBWindowPeer_createDFBWindow(JNIEnv* env, jobject obj, jlong nativeLayer, jint x, jint y, jint width, jint height) {
IDirectFBDisplayLayer *layer = (IDirectFBDisplayLayer *)nativeLayer;
IDirectFBWindow *window;
DFBWindowDescription desc;
if (!layer)
layer=MhpOutput::System::self()->GetMainLayer();
//printf("createDFBWindow %d, %d - %dx%d on layer %p ID %d\n", x, y, width, height, layer, layer->GetID());
/*if (getenv( "MHP_NO_ALPHA" ))
bgAlpha = 255;
if (bgAlpha < 255) {
desc.flags = DWDESC_CAPS;
desc.caps = DWCAPS_ALPHACHANNEL;
}
else
desc.flags = 0;*/
desc.flags=(DFBWindowDescriptionFlags)0;
if (!getenv( "MHP_NO_ALPHA" )) {
DFB_ADD_WINDOW_DESC(desc.flags, DWDESC_CAPS);
desc.caps=DWCAPS_NONE;
DFB_ADD_WINDOW_CAPS(desc.caps, DWCAPS_ALPHACHANNEL);
DFB_ADD_WINDOW_CAPS(desc.caps, DWCAPS_DOUBLEBUFFER);
}
if (x >= 0) {
DFB_ADD_WINDOW_DESC(desc.flags, DWDESC_POSX);
desc.posx = x;
}
if (y >= 0) {
DFB_ADD_WINDOW_DESC(desc.flags, DWDESC_POSY);
desc.posy = y;
}
if (width > 0) {
DFB_ADD_WINDOW_DESC(desc.flags, DWDESC_WIDTH);
desc.width = width;
}
if (height > 0) {
DFB_ADD_WINDOW_DESC(desc.flags, DWDESC_HEIGHT);
desc.height = height;
}
try {
window=layer->CreateWindow(desc);
} catch (DFBException *e) {
printf("DirectFB: Error %s, %s\n", e->GetAction(), e->GetResult());
delete e;
return 0;
}
int ww,hh;window->GetSize(&ww, &hh);
//printf("Created window %p, size %dx%d\n", window, ww, hh);
return (jlong )window;
}
示例3:
static DFBResult
Test_DstGeometry( IDirectFBDisplayLayer *layer, void *arg )
{
int i;
IDirectFBWindow *window;
DFBWindowGeometry geometry;
DFBDimension size;
D_ASSERT( m_toplevel_id != 0 );
/*
* Get the top level window
*/
_T( layer->GetWindow( layer, arg ? (unsigned long) arg : m_toplevel_id, &window ) );
window->GetSize( window, &size.w, &size.h );
/*
* Change destination geometry
*/
{
DFBRectangle rects[] = { { 0, 0, size.w / 2, size.h / 2 },
{ size.w / 2, 0, size.w / 2, size.h / 2 },
{ size.w / 2, size.h / 2, size.w / 2, size.h / 2 },
{ 0, size.h / 2, size.w / 2, size.h / 2 }
};
for (i=0; i<D_ARRAY_SIZE(rects); i++) {
SHOW_TEST( "SetDstGeometry( %4d,%4d-%4dx%4d - [%02d] )...", DFB_RECTANGLE_VALS(&rects[i]), i );
geometry.mode = DWGM_RECTANGLE;
geometry.rectangle = rects[i];
_T( window->SetDstGeometry( window, &geometry ) );
SHOW_RESULT( "...SetDstGeometry( %4d,%4d-%4dx%4d - [%02d] ) done.", DFB_RECTANGLE_VALS(&rects[i]), i );
}
}
SHOW_TEST( "SetDstGeometry( DEFAULT )..." );
geometry.mode = DWGM_DEFAULT;
_T( window->SetDstGeometry( window, &geometry ) );
SHOW_RESULT( "...SetDstGeometry( DEFAULT ) done." );
window->Release( window );
return DFB_OK;
}
示例4:
static struct graphics_device *
directfb_init_device (void)
{
struct graphics_device *gd;
DFBDeviceData *data;
IDirectFBWindow *window;
DFBWindowDescription desc;
desc.flags = (DFBWindowDescriptionFlags)(DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY);
desc.width = directfb_driver.x;
desc.height = directfb_driver.y;
desc.posx = 0;
desc.posy = 0;
retry:
if (layer->CreateWindow (layer, &desc, &window) != DFB_OK) {
if (out_of_memory(MF_GPI, NULL, 0))
goto retry;
return NULL;
}
gd = mem_alloc (sizeof (struct graphics_device));
gd->size.x1 = 0;
gd->size.y1 = 0;
window->GetSize (window, &gd->size.x2, &gd->size.y2);
gd->clip = gd->size;
data = mem_alloc (sizeof (DFBDeviceData));
data->window = window;
data->flip_pending = 0;
if (arrow)
window->SetCursorShape (window, arrow, arrow_hot_x, arrow_hot_y);
window->GetSurface (window, &data->surface);
window->GetID (window, &data->id);
gd->driver_data = data;
gd->user_data = NULL;
directfb_add_to_table (gd);
window->AttachEventBuffer (window, events);
window->SetOpacity (window, FOCUSED_OPACITY);
return gd;
}
示例5: if
int
DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
{
SDL_DFB_DEVICEDATA(_this);
SDL_DFB_WINDOWDATA(window);
DFB_WindowData *gwindata = ((devdata->grabbed_window) ? (DFB_WindowData *) ((devdata->grabbed_window)->driverdata) : NULL);
IDirectFBWindow *dfbwin = windata->dfbwin;
DFBWindowOptions wopts;
if (!windata->is_managed)
return 0;
SDL_DFB_CHECK(dfbwin->GetOptions(dfbwin, &wopts));
switch (evt->type) {
case DWET_BUTTONDOWN:
if (evt->buttons & DIBM_LEFT) {
int pos = WMPos(windata, evt->x, evt->y);
switch (pos) {
case WM_POS_NONE:
return 0;
case WM_POS_CLOSE:
windata->wm_grab = WM_POS_NONE;
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0,
0);
return 1;
case WM_POS_MAX:
windata->wm_grab = WM_POS_NONE;
if (window->flags & SDL_WINDOW_MAXIMIZED) {
SDL_RestoreWindow(window);
} else {
SDL_MaximizeWindow(window);
}
return 1;
case WM_POS_CAPTION:
if (!(wopts & DWOP_KEEP_STACKING)) {
DirectFB_RaiseWindow(_this, window);
}
if (window->flags & SDL_WINDOW_MAXIMIZED)
return 1;
/* fall through */
default:
windata->wm_grab = pos;
if (gwindata != NULL)
SDL_DFB_CHECK(gwindata->dfbwin->UngrabPointer(gwindata->dfbwin));
SDL_DFB_CHECK(dfbwin->GrabPointer(dfbwin));
windata->wm_lastx = evt->cx;
windata->wm_lasty = evt->cy;
}
}
return 1;
case DWET_BUTTONUP:
if (!windata->wm_grab)
return 0;
if (!(evt->buttons & DIBM_LEFT)) {
if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
int dx = evt->cx - windata->wm_lastx;
int dy = evt->cy - windata->wm_lasty;
if (!(wopts & DWOP_KEEP_SIZE)) {
int cw, ch;
if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_BOTTOM)
dx = 0;
else if ((windata->wm_grab & (WM_POS_BOTTOM | WM_POS_RIGHT)) == WM_POS_RIGHT)
dy = 0;
SDL_DFB_CHECK(dfbwin->GetSize(dfbwin, &cw, &ch));
/* necessary to trigger an event - ugly */
SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx + 1, ch + dy));
SDL_DFB_CHECK(dfbwin->EnableEvents(dfbwin, DWET_ALL));
SDL_DFB_CHECK(dfbwin->Resize(dfbwin, cw + dx, ch + dy));
}
}
SDL_DFB_CHECK(dfbwin->UngrabPointer(dfbwin));
if (gwindata != NULL)
SDL_DFB_CHECK(gwindata->dfbwin->GrabPointer(gwindata->dfbwin));
windata->wm_grab = WM_POS_NONE;
return 1;
}
break;
case DWET_MOTION:
if (!windata->wm_grab)
return 0;
if (evt->buttons & DIBM_LEFT) {
int dx = evt->cx - windata->wm_lastx;
int dy = evt->cy - windata->wm_lasty;
if (windata->wm_grab & WM_POS_CAPTION) {
if (!(wopts & DWOP_KEEP_POSITION))
SDL_DFB_CHECK(dfbwin->Move(dfbwin, dx, dy));
}
if (windata->wm_grab & (WM_POS_RIGHT | WM_POS_BOTTOM)) {
if (!(wopts & DWOP_KEEP_SIZE)) {
int cw, ch;
/* Make sure all events are disabled for this operation ! */
SDL_DFB_CHECK(dfbwin->DisableEvents(dfbwin, DWET_ALL));
//.........这里部分代码省略.........
示例6:
static struct graphics_device *
directfb_init_device (void)
{
struct graphics_device *gd;
DFBDeviceData *data;
IDirectFBWindow *window;
DFBWindowDescription desc;
if (!dfb || !layer)
return NULL;
desc.flags = DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_POSX | DWDESC_POSY;
/*desc.width = directfb_driver.x;
desc.height = directfb_driver.y;
desc.posx = 0;
desc.posy = 0;*/
desc.width = (int)w;
desc.height = (int)h;
desc.posx = (int)x;
desc.posy = (int)y;
if (layer->CreateWindow (layer, &desc, &window) != DFB_OK)
return NULL;
gd = mem_alloc (sizeof (struct graphics_device));
gd->size.x1 = 0;
gd->size.y1 = 0;
window->GetSize (window, &gd->size.x2, &gd->size.y2);
gd->clip = gd->size;
data = mem_alloc (sizeof (DFBDeviceData));
data->window = window;
data->mapped = 0;
data->flip_pending = 0;
data->flipWindow = 0;
data->ghostWindow = 0;
if (arrow)
window->SetCursorShape (window, arrow, arrow_hot_x, arrow_hot_y);
window->GetSurface (window, &data->surface);
window->GetID (window, &data->id);
gd->drv = &directfb_driver;
gd->driver_data = data;
gd->user_data = NULL;
directfb_add_to_table (gd);
if (!events)
{
window->CreateEventBuffer (window, &events);
event_timer = install_timer (20, directfb_check_events, events);
}
else
{
window->AttachEventBuffer (window, events);
}
return gd;
}