Previous 199869 Revisions Next

r31542 Thursday 7th August, 2014 at 08:35:31 UTC by Miodrag Milanović
(OSD BRANCH) win_window_info to class, partial (nw)
[/branches/osd/src/osd/modules/debugger]debugwin.c
[/branches/osd/src/osd/modules/sound]direct_sound.c
[/branches/osd/src/osd/windows]d3dhlsl.c drawd3d.c drawdd.c drawgdi.c drawnone.c input.c video.c window.c window.h winmain.c

branches/osd/src/osd/modules/debugger/debugwin.c
r31541r31542
512512   // create the window
513513   info->handler = handler;
514514   info->wnd = win_create_window_ex_utf8(DEBUG_WINDOW_STYLE_EX, "MAMEDebugWindow", title, DEBUG_WINDOW_STYLE,
515         0, 0, 100, 100, win_window_list->hwnd, create_standard_menubar(), GetModuleHandle(NULL), info);
515         0, 0, 100, 100, win_window_list->m_hwnd, create_standard_menubar(), GetModuleHandle(NULL), info);
516516   if (info->wnd == NULL)
517517      goto cleanup;
518518
r31541r31542
30743074{
30753075   debugwin_info *info;
30763076   if (!show)
3077      SetForegroundWindow(win_window_list->hwnd);
3077      SetForegroundWindow(win_window_list->m_hwnd);
30783078   for (info = window_list; info != NULL; info = info->next)
30793079      smart_show_window(info->wnd, show);
30803080}
branches/osd/src/osd/modules/sound/direct_sound.c
r31541r31542
234234   }
235235
236236   // set the cooperative level
237   result = IDirectSound_SetCooperativeLevel(dsound, win_window_list->hwnd, DSSCL_PRIORITY);
237   result = IDirectSound_SetCooperativeLevel(dsound, win_window_list->m_hwnd, DSSCL_PRIORITY);
238238   if (result != DS_OK)
239239   {
240240      osd_printf_error("Error setting DirectSound cooperative level: %08x\n", (UINT32)result);
branches/osd/src/osd/windows/input.c
r31541r31542
614614      POINT mousepos;
615615
616616      // get the position relative to the window
617      GetClientRect(win_window_list->hwnd, &client_rect);
617      GetClientRect(win_window_list->m_hwnd, &client_rect);
618618      mousepos.x = x;
619619      mousepos.y = y;
620      ScreenToClient(win_window_list->hwnd, &mousepos);
620      ScreenToClient(win_window_list->m_hwnd, &mousepos);
621621
622622      // convert to absolute coordinates
623623      devinfo->mouse.state.lX = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right);
r31541r31542
10431043      RECT client_rect;
10441044
10451045      // get the position relative to the window
1046      GetClientRect(win_window_list->hwnd, &client_rect);
1047      ScreenToClient(win_window_list->hwnd, &mousepos);
1046      GetClientRect(win_window_list->m_hwnd, &client_rect);
1047      ScreenToClient(win_window_list->m_hwnd, &mousepos);
10481048
10491049      // convert to absolute coordinates
10501050      xpos = normalize_absolute_axis(mousepos.x, client_rect.left, client_rect.right);
r31541r31542
12181218   }
12191219
12201220   // set the cooperative level
1221   result = IDirectInputDevice_SetCooperativeLevel(devinfo->dinput.device, win_window_list->hwnd, cooperative_level);
1221   result = IDirectInputDevice_SetCooperativeLevel(devinfo->dinput.device, win_window_list->m_hwnd, cooperative_level);
12221222   if (result != DI_OK)
12231223      goto error;
12241224   return devinfo;
r31541r31542
17021702      reglist[regcount].usUsagePage = 0x01;
17031703      reglist[regcount].usUsage = 0x06;
17041704      reglist[regcount].dwFlags = RIDEV_INPUTSINK;
1705      reglist[regcount].hwndTarget = win_window_list->hwnd;
1705      reglist[regcount].hwndTarget = win_window_list->m_hwnd;
17061706      regcount++;
17071707   }
17081708   if (mouse_list != NULL)
r31541r31542
17101710      reglist[regcount].usUsagePage = 0x01;
17111711      reglist[regcount].usUsage = 0x02;
17121712      reglist[regcount].dwFlags = 0;
1713      reglist[regcount].hwndTarget = win_window_list->hwnd;
1713      reglist[regcount].hwndTarget = win_window_list->m_hwnd;
17141714      regcount++;
17151715   }
17161716
branches/osd/src/osd/windows/winmain.c
r31541r31542
494494      winwindow_toggle_full_screen();
495495
496496   vsnprintf(buffer, ARRAY_LENGTH(buffer), format, argptr);
497   win_message_box_utf8(win_window_list ? win_window_list->hwnd : NULL, buffer, emulator_info::get_appname(), MB_OK);
497   win_message_box_utf8(win_window_list ? win_window_list->m_hwnd : NULL, buffer, emulator_info::get_appname(), MB_OK);
498498}
499499
500500
r31541r31542
625625
626626   // notify listeners of screen configuration
627627   astring tempstring;
628   for (win_window_info *info = win_window_list; info != NULL; info = info->next)
628   for (win_window_info *info = win_window_list; info != NULL; info = info->m_next)
629629   {
630      char *tmp = utf8_from_tstring(info->monitor->info.szDevice);
630      char *tmp = utf8_from_tstring(info->m_monitor->info.szDevice);
631631      tempstring.printf("Orientation(%s)", tmp);
632      output_set_value(tempstring, info->targetorient);
632      output_set_value(tempstring, info->m_targetorient);
633633      osd_free(tmp);
634634   }
635635
branches/osd/src/osd/windows/drawdd.c
r31541r31542
219219
220220   // allocate memory for our structures
221221   dd = global_alloc_clear(dd_info);
222   window->drawdata = dd;
222   window->m_drawdata = dd;
223223
224224   // configure the adapter for the mode we want
225225   if (config_adapter_mode(window))
r31541r31542
245245
246246static void drawdd_window_destroy(win_window_info *window)
247247{
248   dd_info *dd = (dd_info *)window->drawdata;
248   dd_info *dd = (dd_info *)window->m_drawdata;
249249
250250   // skip if nothing
251251   if (dd == NULL)
r31541r31542
256256
257257   // free the memory in the window
258258   global_free(dd);
259   window->drawdata = NULL;
259   window->m_drawdata = NULL;
260260}
261261
262262
r31541r31542
267267
268268static render_primitive_list *drawdd_window_get_primitives(win_window_info *window)
269269{
270   dd_info *dd = (dd_info *)window->drawdata;
270   dd_info *dd = (dd_info *)window->m_drawdata;
271271
272272   compute_blit_surface_size(window);
273   window->target->set_bounds(dd->blitwidth, dd->blitheight, 0);
274   window->target->set_max_update_rate((dd->refresh == 0) ? dd->origmode.dwRefreshRate : dd->refresh);
273   window->m_target->set_bounds(dd->blitwidth, dd->blitheight, 0);
274   window->m_target->set_max_update_rate((dd->refresh == 0) ? dd->origmode.dwRefreshRate : dd->refresh);
275275
276   return &window->target->get_primitives();
276   return &window->m_target->get_primitives();
277277}
278278
279279
r31541r31542
284284
285285static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
286286{
287   dd_info *dd = (dd_info *)window->drawdata;
287   dd_info *dd = (dd_info *)window->m_drawdata;
288288   render_primitive *prim;
289289   int usemembuffer = FALSE;
290290   HRESULT result;
r31541r31542
324324   }
325325
326326   // render to it
327   window->primlist->acquire_lock();
327   window->m_primlist->acquire_lock();
328328
329329   // scan the list of primitives for tricky stuff
330   for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
330   for (prim = window->m_primlist->first(); prim != NULL; prim = prim->next())
331331      if (PRIMFLAG_GET_BLENDMODE(prim->flags) != BLENDMODE_NONE ||
332332         (prim->texture.base != NULL && PRIMFLAG_GET_TEXFORMAT(prim->flags) == TEXFORMAT_ARGB32))
333333      {
r31541r31542
343343      // based on the target format, use one of our standard renderers
344344      switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
345345      {
346         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
347         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16>::draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
348         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0>::draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
349         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0>::draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
346         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window->m_primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
347         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16>::draw_primitives(*window->m_primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
348         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0>::draw_primitives(*window->m_primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
349         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0>::draw_primitives(*window->m_primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth);  break;
350350         default:
351351            osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
352352            break;
r31541r31542
379379      // based on the target format, use one of our standard renderers
380380      switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
381381      {
382         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
383         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
384         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
385         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0, true>::draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
382         case 0x00ff0000:    software_renderer<UINT32, 0,0,0, 16,8,0, true>::draw_primitives(*window->m_primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
383         case 0x000000ff:    software_renderer<UINT32, 0,0,0, 0,8,16, true>::draw_primitives(*window->m_primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
384         case 0xf800:        software_renderer<UINT16, 3,2,3, 11,5,0, true>::draw_primitives(*window->m_primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
385         case 0x7c00:        software_renderer<UINT16, 3,3,3, 10,5,0, true>::draw_primitives(*window->m_primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
386386         default:
387387            osd_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
388388            break;
389389      }
390390   }
391   window->primlist->release_lock();
391   window->m_primlist->release_lock();
392392
393393   // unlock and blit
394394   result = IDirectDrawSurface7_Unlock(dd->blit, NULL);
395395   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X unlocking blit surface\n", (int)result);
396396
397397   // sync to VBLANK
398   if ((video_config.waitvsync || video_config.syncrefresh) && window->machine().video().throttled() && (!window->fullscreen || dd->back == NULL))
398   if ((video_config.waitvsync || video_config.syncrefresh) && window->machine().video().throttled() && (!window->m_fullscreen || dd->back == NULL))
399399   {
400400      result = IDirectDraw7_WaitForVerticalBlank(dd->ddraw, DDWAITVB_BLOCKBEGIN, NULL);
401401      if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result);
r31541r31542
414414
415415static int ddraw_create(win_window_info *window)
416416{
417   dd_info *dd = (dd_info *)window->drawdata;
417   dd_info *dd = (dd_info *)window->m_drawdata;
418418   HRESULT result;
419419   int verify;
420420
r31541r31542
442442
443443   // set the cooperative level
444444   // for non-window modes, we will use full screen here
445   result = IDirectDraw7_SetCooperativeLevel(dd->ddraw, win_window_list->hwnd, DDSCL_SETFOCUSWINDOW);
445   result = IDirectDraw7_SetCooperativeLevel(dd->ddraw, win_window_list->m_hwnd, DDSCL_SETFOCUSWINDOW);
446446   if (result != DD_OK)
447447   {
448448      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(FOCUSWINDOW) call\n", (int)result);
449449      goto error;
450450   }
451   result = IDirectDraw7_SetCooperativeLevel(dd->ddraw, window->hwnd, DDSCL_SETDEVICEWINDOW | (window->fullscreen ? DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE : DDSCL_NORMAL));
451   result = IDirectDraw7_SetCooperativeLevel(dd->ddraw, window->m_hwnd, DDSCL_SETDEVICEWINDOW | (window->m_fullscreen ? DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE : DDSCL_NORMAL));
452452   if (result != DD_OK)
453453   {
454454      osd_printf_verbose("DirectDraw: Error %08X during IDirectDraw7_SetCooperativeLevel(DEVICEWINDOW) call\n", (int)result);
r31541r31542
456456   }
457457
458458   // full screen mode: set the resolution
459   if (window->fullscreen && video_config.switchres)
459   if (window->m_fullscreen && video_config.switchres)
460460   {
461461      result = IDirectDraw7_SetDisplayMode(dd->ddraw, dd->width, dd->height, 32, dd->refresh, 0);
462462      if (result != DD_OK)
r31541r31542
481481
482482static int ddraw_create_surfaces(win_window_info *window)
483483{
484   dd_info *dd = (dd_info *)window->drawdata;
484   dd_info *dd = (dd_info *)window->m_drawdata;
485485   HRESULT result;
486486
487487   // make a description of the primary surface
r31541r31542
491491   dd->primarydesc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
492492
493493   // for triple-buffered full screen mode, allocate flipping surfaces
494   if (window->fullscreen && video_config.triplebuf)
494   if (window->m_fullscreen && video_config.triplebuf)
495495   {
496496      dd->primarydesc.dwFlags |= DDSD_BACKBUFFERCOUNT;
497497      dd->primarydesc.ddsCaps.dwCaps |= DDSCAPS_FLIP | DDSCAPS_COMPLEX;
r31541r31542
504504
505505   // full screen mode: get the back surface
506506   dd->back = NULL;
507   if (window->fullscreen && video_config.triplebuf)
507   if (window->m_fullscreen && video_config.triplebuf)
508508   {
509509      DDSCAPS2 caps = { DDSCAPS_BACKBUFFER };
510510      result = IDirectDrawSurface7_GetAttachedSurface(dd->primary, &caps, &dd->back);
r31541r31542
544544      goto error;
545545
546546   // create a clipper for windowed mode
547   if (!window->fullscreen && create_clipper(window))
547   if (!window->m_fullscreen && create_clipper(window))
548548      goto error;
549549
550550   // full screen mode: set the gamma
551   if (window->fullscreen)
551   if (window->m_fullscreen)
552552   {
553553      // only set the gamma if it's not 1.0f
554554      windows_options &options = downcast<windows_options &>(window->machine().options());
r31541r31542
600600
601601static void ddraw_delete(win_window_info *window)
602602{
603   dd_info *dd = (dd_info *)window->drawdata;
603   dd_info *dd = (dd_info *)window->m_drawdata;
604604
605605   // free surfaces
606606   ddraw_delete_surfaces(window);
r31541r31542
610610      IDirectDraw7_RestoreDisplayMode(dd->ddraw);
611611
612612   // reset cooperative level
613   if (dd->ddraw != NULL && window->hwnd != NULL)
614      IDirectDraw7_SetCooperativeLevel(dd->ddraw, window->hwnd, DDSCL_NORMAL);
613   if (dd->ddraw != NULL && window->m_hwnd != NULL)
614      IDirectDraw7_SetCooperativeLevel(dd->ddraw, window->m_hwnd, DDSCL_NORMAL);
615615
616616   // release the DirectDraw object itself
617617   if (dd->ddraw != NULL)
r31541r31542
627627
628628static void ddraw_delete_surfaces(win_window_info *window)
629629{
630   dd_info *dd = (dd_info *)window->drawdata;
630   dd_info *dd = (dd_info *)window->m_drawdata;
631631
632632   // release the gamma control
633633   if (dd->gamma != NULL)
r31541r31542
699699
700700static int ddraw_test_cooperative(win_window_info *window)
701701{
702   dd_info *dd = (dd_info *)window->drawdata;
702   dd_info *dd = (dd_info *)window->m_drawdata;
703703   HRESULT result;
704704
705705   // check our current status; if we lost the device, punt to GDI
r31541r31542
769769
770770static int create_clipper(win_window_info *window)
771771{
772   dd_info *dd = (dd_info *)window->drawdata;
772   dd_info *dd = (dd_info *)window->m_drawdata;
773773   HRESULT result;
774774
775775   // create a clipper for the primary surface
r31541r31542
781781   }
782782
783783   // set the clipper's hwnd
784   result = IDirectDrawClipper_SetHWnd(dd->clipper, 0, window->hwnd);
784   result = IDirectDrawClipper_SetHWnd(dd->clipper, 0, window->m_hwnd);
785785   if (result != DD_OK)
786786   {
787787      osd_printf_verbose("DirectDraw: Error %08X setting clipper hwnd\n", (int)result);
r31541r31542
806806
807807static void compute_blit_surface_size(win_window_info *window)
808808{
809   dd_info *dd = (dd_info *)window->drawdata;
809   dd_info *dd = (dd_info *)window->m_drawdata;
810810   INT32 newwidth, newheight;
811811   int xscale, yscale;
812812   RECT client;
813813
814814   // start with the minimum size
815   window->target->compute_minimum_size(newwidth, newheight);
815   window->m_target->compute_minimum_size(newwidth, newheight);
816816
817817   // get the window's client rectangle
818   GetClientRect(window->hwnd, &client);
818   GetClientRect(window->m_hwnd, &client);
819819
820820   // hardware stretch case: apply prescale
821821   if (video_config.hwstretch)
r31541r31542
842842      if (video_config.keepaspect)
843843      {
844844         win_monitor_info *monitor = winwindow_video_window_monitor(window, NULL);
845         window->target->compute_visible_area(target_width, target_height, monitor->get_aspect(), window->target->orientation(), target_width, target_height);
845         window->m_target->compute_visible_area(target_width, target_height, monitor->get_aspect(), window->m_target->orientation(), target_width, target_height);
846846         desired_aspect = (float)target_width / (float)target_height;
847847      }
848848
r31541r31542
930930
931931static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight)
932932{
933   dd_info *dd = (dd_info *)window->drawdata;
933   dd_info *dd = (dd_info *)window->m_drawdata;
934934   IDirectDrawSurface7 *target = (dd->back != NULL) ? dd->back : dd->primary;
935935   win_monitor_info *monitor = winwindow_video_window_monitor(window, NULL);
936936   DDBLTFX blitfx = { sizeof(DDBLTFX) };
r31541r31542
944944   source.bottom = srcheight;
945945
946946   // compute outer rect -- windowed version
947   if (!window->fullscreen)
947   if (!window->m_fullscreen)
948948   {
949      GetClientRect(window->hwnd, &outer);
950      ClientToScreen(window->hwnd, &((LPPOINT)&outer)[0]);
951      ClientToScreen(window->hwnd, &((LPPOINT)&outer)[1]);
949      GetClientRect(window->m_hwnd, &outer);
950      ClientToScreen(window->m_hwnd, &((LPPOINT)&outer)[0]);
951      ClientToScreen(window->m_hwnd, &((LPPOINT)&outer)[1]);
952952
953953      // adjust to be relative to the monitor
954954      outer.left -= monitor->info.rcMonitor.left;
r31541r31542
987987   else if (video_config.keepaspect)
988988   {
989989      // compute the appropriate visible area
990      window->target->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->get_aspect(), window->target->orientation(), dstwidth, dstheight);
990      window->m_target->compute_visible_area(rect_width(&outer), rect_height(&outer), monitor->get_aspect(), window->m_target->orientation(), dstwidth, dstheight);
991991   }
992992
993993   // center within
r31541r31542
10501050   if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X blitting to the screen\n", (int)result);
10511051
10521052   // page flip if triple buffered
1053   if (window->fullscreen && dd->back != NULL)
1053   if (window->m_fullscreen && dd->back != NULL)
10541054   {
10551055      result = IDirectDrawSurface7_Flip(dd->primary, NULL, DDFLIP_WAIT);
10561056      if (result != DD_OK) osd_printf_verbose("DirectDraw: Error %08X waiting for VBLANK\n", (int)result);
r31541r31542
10661066static int config_adapter_mode(win_window_info *window)
10671067{
10681068   DDDEVICEIDENTIFIER2 identifier;
1069   dd_info *dd = (dd_info *)window->drawdata;
1069   dd_info *dd = (dd_info *)window->m_drawdata;
10701070   HRESULT result;
10711071
10721072   // choose the monitor number
1073   get_adapter_for_monitor(dd, window->monitor);
1073   get_adapter_for_monitor(dd, window->m_monitor);
10741074
10751075   // create a temporary DirectDraw object
10761076   result = (*directdrawcreateex)(dd->adapter_ptr, (LPVOID *)&dd->ddraw, WRAP_REFIID(IID_IDirectDraw7), NULL);
r31541r31542
11011101   }
11021102
11031103   // choose a resolution: full screen mode case
1104   if (window->fullscreen)
1104   if (window->m_fullscreen)
11051105   {
11061106      // default to the current mode exactly
11071107      dd->width = dd->origmode.dwWidth;
r31541r31542
11181118   dd->ddraw = NULL;
11191119
11201120   // if we're not changing resolutions, make sure we have a resolution we can handle
1121   if (!window->fullscreen || !video_config.switchres)
1121   if (!window->m_fullscreen || !video_config.switchres)
11221122   {
11231123      switch (dd->origmode.ddpfPixelFormat.dwRBitMask)
11241124      {
r31541r31542
11951195{
11961196   float size_score, refresh_score, final_score;
11971197   mode_enum_info *einfo = (mode_enum_info *)context;
1198   dd_info *dd = (dd_info *)einfo->window->drawdata;
1198   dd_info *dd = (dd_info *)einfo->window->m_drawdata;
11991199
12001200   // skip non-32 bit modes
12011201   if (desc->ddpfPixelFormat.dwRGBBitCount != 32)
r31541r31542
12131213      size_score *= 0.1f;
12141214
12151215   // if we're looking for a particular mode, that's a winner
1216   if (desc->dwWidth == einfo->window->maxwidth && desc->dwHeight == einfo->window->maxheight)
1216   if (desc->dwWidth == einfo->window->m_maxwidth && desc->dwHeight == einfo->window->m_maxheight)
12171217      size_score = 2.0f;
12181218
12191219   // compute refresh score
r31541r31542
12241224      refresh_score *= 0.1f;
12251225
12261226   // if we're looking for a particular refresh, make sure it matches
1227   if (desc->dwRefreshRate == einfo->window->refresh)
1227   if (desc->dwRefreshRate == einfo->window->m_refresh)
12281228      refresh_score = 2.0f;
12291229
12301230   // weight size and refresh equally
r31541r31542
12501250
12511251static void pick_best_mode(win_window_info *window)
12521252{
1253   dd_info *dd = (dd_info *)window->drawdata;
1253   dd_info *dd = (dd_info *)window->m_drawdata;
12541254   mode_enum_info einfo;
12551255   HRESULT result;
12561256
r31541r31542
12581258   // note: technically we should not be calling this from an alternate window
12591259   // thread; however, it is only done during init time, and the init code on
12601260   // the main thread is waiting for us to finish, so it is safe to do so here
1261   window->target->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
1261   window->m_target->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
12621262
12631263   // use those as the target for now
12641264   einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale);
branches/osd/src/osd/windows/video.c
r31541r31542
8484   for (index = 0; index < video_config.numscreens; index++)
8585      winwindow_video_window_create(machine(), index, pick_monitor(options, index), &video_config.window[index]);
8686   if (video_config.mode != VIDEO_MODE_NONE)
87      SetForegroundWindow(win_window_list->hwnd);
87      SetForegroundWindow(win_window_list->m_hwnd);
8888
8989   return true;
9090}
r31541r31542
187187
188188   // if we're not skipping this redraw, update all windows
189189   if (!skip_redraw)
190      for (win_window_info *window = win_window_list; window != NULL; window = window->next)
191         winwindow_video_window_update(window);
190      for (win_window_info *window = win_window_list; window != NULL; window = window->m_next)
191         window->update();
192192
193193   // poll the joystick values here
194194   winwindow_process_events(machine(), TRUE, FALSE);
branches/osd/src/osd/windows/window.c
r31541r31542
264264   while (win_window_list != NULL)
265265   {
266266      win_window_info *temp = win_window_list;
267      win_window_list = temp->next;
267      win_window_list = temp->m_next;
268268      winwindow_video_window_destroy(temp);
269269   }
270270
r31541r31542
293293}
294294
295295
296win_window_info::win_window_info(running_machine &machine)
297      : m_next(NULL),
298      m_init_state(0),
299      m_hwnd(0),
300      m_focus_hwnd(0),
301      m_startmaximized(0),
302      m_isminimized(0),
303      m_ismaximized(0),
304      m_resize_state(0),
305      m_monitor(0),
306      m_fullscreen(0),
307      m_fullscreen_safe(0),
308      m_maxwidth(0),
309      m_maxheight(0),
310      m_refresh(0),
311      m_aspect(0),
312      m_render_lock(NULL),
313      m_target(NULL),
314      m_targetview(0),
315      m_targetorient(0),
316      m_primlist(NULL),       
317      m_lastclicktime(0),
318      m_lastclickx(0),
319      m_lastclicky(0),
320      m_drawdata(NULL),
321      m_machine(machine)
322{
323   memset(m_title,0,sizeof(m_title));
324   m_non_fullscreen_bounds.left = 0; 
325   m_non_fullscreen_bounds.top = 0; 
326   m_non_fullscreen_bounds.right  = 0; 
327   m_non_fullscreen_bounds.bottom = 0;
328}
296329
330win_window_info::~win_window_info()
331{
332}
333
334   
297335//============================================================
298336//  winwindow_process_events_periodic
299337//  (main thread)
r31541r31542
321359{
322360   win_window_info *window;
323361
324   for (window = win_window_list; window != NULL; window = window->next)
325      if (window->hwnd == hwnd)
362   for (window = win_window_list; window != NULL; window = window->m_next)
363      if (window->m_hwnd == hwnd)
326364         return TRUE;
327365
328366   return FALSE;
r31541r31542
471509   assert(GetCurrentThreadId() == main_threadid);
472510
473511   // iterate over windows and request a snap
474   for (window = win_window_list; window != NULL; window = window->next)
512   for (window = win_window_list; window != NULL; window = window->m_next)
475513   {
476514      (*draw.window_save)(window);
477515   }
r31541r31542
494532   assert(GetCurrentThreadId() == main_threadid);
495533
496534   // iterate over windows and request a snap
497   for (window = win_window_list; window != NULL; window = window->next)
535   for (window = win_window_list; window != NULL; window = window->m_next)
498536   {
499537      (*draw.window_toggle_fsfx)(window);
500538   }
r31541r31542
517555   assert(GetCurrentThreadId() == main_threadid);
518556
519557   // iterate over windows and request a snap
520   for (window = win_window_list; window != NULL; window = window->next)
558   for (window = win_window_list; window != NULL; window = window->m_next)
521559   {
522560      (*draw.window_record)(window);
523561   }
r31541r31542
537575   assert(GetCurrentThreadId() == main_threadid);
538576
539577   // if we are in debug mode, never go full screen
540   for (window = win_window_list; window != NULL; window = window->next)
578   for (window = win_window_list; window != NULL; window = window->m_next)
541579      if (window->machine().debug_flags & DEBUG_FLAG_OSD_ENABLED)
542580         return;
543581
r31541r31542
545583   video_config.windowed = !video_config.windowed;
546584
547585   // iterate over windows and toggle their fullscreen state
548   for (window = win_window_list; window != NULL; window = window->next)
549      SendMessage(window->hwnd, WM_USER_SET_FULLSCREEN, !video_config.windowed, 0);
550   SetForegroundWindow(win_window_list->hwnd);
586   for (window = win_window_list; window != NULL; window = window->m_next)
587      SendMessage(window->m_hwnd, WM_USER_SET_FULLSCREEN, !video_config.windowed, 0);
588   SetForegroundWindow(win_window_list->m_hwnd);
551589}
552590
553591
r31541r31542
563601   win_window_info *window;
564602
565603   // see if one of the video windows has focus
566   for (window = win_window_list; window != NULL; window = window->next)
567      if (focuswnd == window->hwnd)
604   for (window = win_window_list; window != NULL; window = window->m_next)
605      if (focuswnd == window->m_hwnd)
568606         return TRUE;
569607
570608   return FALSE;
r31541r31542
601639      GetCursorPos(&saved_cursor_pos);
602640
603641      // clip cursor to game video window
604      GetClientRect(window->hwnd, &bounds);
605      ClientToScreen(window->hwnd, &((POINT *)&bounds)[0]);
606      ClientToScreen(window->hwnd, &((POINT *)&bounds)[1]);
642      GetClientRect(window->m_hwnd, &bounds);
643      ClientToScreen(window->m_hwnd, &((POINT *)&bounds)[0]);
644      ClientToScreen(window->m_hwnd, &((POINT *)&bounds)[1]);
607645      ClipCursor(&bounds);
608646   }
609647   else
r31541r31542
636674   assert(GetCurrentThreadId() == main_threadid);
637675
638676   // allocate a new window object
639   window = global_alloc_clear(win_window_info(machine));
677   window = global_alloc(win_window_info(machine));
640678   //printf("%d, %d\n", config->width, config->height);
641   window->maxwidth = config->width;
642   window->maxheight = config->height;
643   window->refresh = config->refresh;
644   window->monitor = monitor;
645   window->fullscreen = !video_config.windowed;
679   window->m_maxwidth = config->width;
680   window->m_maxheight = config->height;
681   window->m_refresh = config->refresh;
682   window->m_monitor = monitor;
683   window->m_fullscreen = !video_config.windowed;
646684
647685   // see if we are safe for fullscreen
648   window->fullscreen_safe = TRUE;
649   for (win = win_window_list; win != NULL; win = win->next)
650      if (win->monitor == monitor)
651         window->fullscreen_safe = FALSE;
686   window->m_fullscreen_safe = TRUE;
687   for (win = win_window_list; win != NULL; win = win->m_next)
688      if (win->m_monitor == monitor)
689         window->m_fullscreen_safe = FALSE;
652690
653691   // add us to the list
654692   *last_window_ptr = window;
655   last_window_ptr = &window->next;
693   last_window_ptr = &window->m_next;
656694
657695   // create a lock that we can use to skip blitting
658   window->render_lock = osd_lock_alloc();
696   window->m_render_lock = osd_lock_alloc();
659697
660698   // load the layout
661   window->target = machine.render().target_alloc();
699   window->m_target = machine.render().target_alloc();
662700
663701   // set the specific view
664702   windows_options &options = downcast<windows_options &>(machine.options());
665703   set_starting_view(index, window, options.view(index));
666704
667705   // remember the current values in case they change
668   window->targetview = window->target->view();
669   window->targetorient = window->target->orientation();
670   window->targetlayerconfig = window->target->layer_config();
706   window->m_targetview = window->m_target->view();
707   window->m_targetorient = window->m_target->orientation();
708   window->m_targetlayerconfig = window->m_target->layer_config();
671709
672710   // make the window title
673711   if (video_config.numscreens == 1)
674      sprintf(window->title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name);
712      sprintf(window->m_title, "%s: %s [%s]", emulator_info::get_appname(), machine.system().description, machine.system().name);
675713   else
676      sprintf(window->title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index);
714      sprintf(window->m_title, "%s: %s [%s] - Screen %d", emulator_info::get_appname(), machine.system().description, machine.system().name, index);
677715
678716   // set the initial maximized state
679   window->startmaximized = options.maximize();
717   window->m_startmaximized = options.maximize();
680718
681719   // finish the window creation on the window thread
682720   if (multithreading_enabled)
r31541r31542
685723      WaitForSingleObject(window_thread_ready_event, INFINITE);
686724
687725      PostThreadMessage(window_threadid, WM_USER_FINISH_CREATE_WINDOW, 0, (LPARAM)window);
688      while (window->init_state == 0)
726      while (window->m_init_state == 0)
689727      {
690728         winwindow_process_events(machine, 0, 1); //pump the message queue
691729         Sleep(1);
692730      }
693731   }
694732   else
695      window->init_state = complete_create(window) ? -1 : 1;
733      window->m_init_state = complete_create(window) ? -1 : 1;
696734
697735   // handle error conditions
698   if (window->init_state == -1)
736   if (window->m_init_state == -1)
699737      fatalerror("Unable to complete window creation\n");
700738}
701739
r31541r31542
713751   assert(GetCurrentThreadId() == main_threadid);
714752
715753   // remove us from the list
716   for (prevptr = &win_window_list; *prevptr != NULL; prevptr = &(*prevptr)->next)
754   for (prevptr = &win_window_list; *prevptr != NULL; prevptr = &(*prevptr)->m_next)
717755      if (*prevptr == window)
718756      {
719         *prevptr = window->next;
757         *prevptr = window->m_next;
720758         break;
721759      }
722760
723761   // destroy the window
724   if (window->hwnd != NULL)
725      SendMessage(window->hwnd, WM_USER_SELF_TERMINATE, 0, 0);
762   if (window->m_hwnd != NULL)
763      SendMessage(window->m_hwnd, WM_USER_SELF_TERMINATE, 0, 0);
726764
727765   // free the render target
728   window->machine().render().target_free(window->target);
766   window->machine().render().target_free(window->m_target);
729767
730768   // free the lock
731   osd_lock_free(window->render_lock);
769   osd_lock_free(window->m_render_lock);
732770
733771   // free the window itself
734772   global_free(window);
r31541r31542
741779//  (main thread)
742780//============================================================
743781
744void winwindow_video_window_update(win_window_info *window)
782void win_window_info::update()
745783{
746784   int targetview, targetorient;
747785   render_layer_config targetlayerconfig;
r31541r31542
751789   mtlog_add("winwindow_video_window_update: begin");
752790
753791   // see if the target has changed significantly in window mode
754   targetview = window->target->view();
755   targetorient = window->target->orientation();
756   targetlayerconfig = window->target->layer_config();
757   if (targetview != window->targetview || targetorient != window->targetorient || targetlayerconfig != window->targetlayerconfig)
792   targetview = m_target->view();
793   targetorient = m_target->orientation();
794   targetlayerconfig = m_target->layer_config();
795   if (targetview != m_targetview || targetorient != m_targetorient || targetlayerconfig != m_targetlayerconfig)
758796   {
759      window->targetview = targetview;
760      window->targetorient = targetorient;
761      window->targetlayerconfig = targetlayerconfig;
797      m_targetview = targetview;
798      m_targetorient = targetorient;
799      m_targetlayerconfig = targetlayerconfig;
762800
763801      // in window mode, reminimize/maximize
764      if (!window->fullscreen)
802      if (!m_fullscreen)
765803      {
766         if (window->isminimized)
767            SendMessage(window->hwnd, WM_USER_SET_MINSIZE, 0, 0);
768         if (window->ismaximized)
769            SendMessage(window->hwnd, WM_USER_SET_MAXSIZE, 0, 0);
804         if (m_isminimized)
805            SendMessage(m_hwnd, WM_USER_SET_MINSIZE, 0, 0);
806         if (m_ismaximized)
807            SendMessage(m_hwnd, WM_USER_SET_MAXSIZE, 0, 0);
770808      }
771809   }
772810
773811   // if we're visible and running and not in the middle of a resize, draw
774   if (window->hwnd != NULL && window->target != NULL && window->drawdata != NULL)
812   if (m_hwnd != NULL && m_target != NULL && m_drawdata != NULL)
775813   {
776814      int got_lock = TRUE;
777815
778816      mtlog_add("winwindow_video_window_update: try lock");
779817
780818      // only block if we're throttled
781      if (window->machine().video().throttled() || timeGetTime() - last_update_time > 250)
782         osd_lock_acquire(window->render_lock);
819      if (machine().video().throttled() || timeGetTime() - last_update_time > 250)
820         osd_lock_acquire(m_render_lock);
783821      else
784         got_lock = osd_lock_try(window->render_lock);
822         got_lock = osd_lock_try(m_render_lock);
785823
786824      // only render if we were able to get the lock
787825      if (got_lock)
r31541r31542
791829         mtlog_add("winwindow_video_window_update: got lock");
792830
793831         // don't hold the lock; we just used it to see if rendering was still happening
794         osd_lock_release(window->render_lock);
832         osd_lock_release(m_render_lock);
795833
796834         // ensure the target bounds are up-to-date, and then get the primitives
797         primlist = (*draw.window_get_primitives)(window);
835         primlist = (*draw.window_get_primitives)(this);
798836
799837         // post a redraw request with the primitive list as a parameter
800838         last_update_time = timeGetTime();
801839         mtlog_add("winwindow_video_window_update: PostMessage start");
802840         if (multithreading_enabled)
803            PostMessage(window->hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
841            PostMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
804842         else
805            SendMessage(window->hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
843            SendMessage(m_hwnd, WM_USER_REDRAW, 0, (LPARAM)primlist);
806844         mtlog_add("winwindow_video_window_update: PostMessage end");
807845      }
808846   }
r31541r31542
822860   win_monitor_info *monitor;
823861
824862   // in window mode, find the nearest
825   if (!window->fullscreen)
863   if (!window->m_fullscreen)
826864   {
827865      if (proposed != NULL)
828866         monitor = winvideo_monitor_from_handle(MonitorFromRect(proposed, MONITOR_DEFAULTTONEAREST));
829867      else
830         monitor = winvideo_monitor_from_handle(MonitorFromWindow(window->hwnd, MONITOR_DEFAULTTONEAREST));
868         monitor = winvideo_monitor_from_handle(MonitorFromWindow(window->m_hwnd, MONITOR_DEFAULTTONEAREST));
831869   }
832870
833871   // in full screen, just use the configured monitor
834872   else
835      monitor = window->monitor;
873      monitor = window->m_monitor;
836874
837875   // make sure we're up-to-date
838876   monitor->refresh();
r31541r31542
889927      view = defview;
890928
891929   // query the video system to help us pick a view
892   viewindex = window->target->configured_view(view, index, video_config.numscreens);
930   viewindex = window->m_target->configured_view(view, index, video_config.numscreens);
893931
894932   // set the view
895   window->target->set_view(viewindex);
933   window->m_target->set_view(viewindex);
896934}
897935
898936
r31541r31542
10121050INLINE int wnd_extra_width(win_window_info *window)
10131051{
10141052   RECT temprect = { 100, 100, 200, 200 };
1015   if (window->fullscreen)
1053   if (window->m_fullscreen)
10161054      return 0;
10171055   AdjustWindowRectEx(&temprect, WINDOW_STYLE, win_has_menu(window), WINDOW_STYLE_EX);
10181056   return rect_width(&temprect) - 100;
r31541r31542
10281066INLINE int wnd_extra_height(win_window_info *window)
10291067{
10301068   RECT temprect = { 100, 100, 200, 200 };
1031   if (window->fullscreen)
1069   if (window->m_fullscreen)
10321070      return 0;
10331071   AdjustWindowRectEx(&temprect, WINDOW_STYLE, win_has_menu(window), WINDOW_STYLE_EX);
10341072   return rect_height(&temprect) - 100;
r31541r31542
11131151            case WM_USER_FINISH_CREATE_WINDOW:
11141152            {
11151153               win_window_info *window = (win_window_info *)message.lParam;
1116               window->init_state = complete_create(window) ? -1 : 1;
1154               window->m_init_state = complete_create(window) ? -1 : 1;
11171155               dispatch = FALSE;
11181156               break;
11191157            }
r31541r31542
11471185   assert(GetCurrentThreadId() == window_threadid);
11481186
11491187   // get the monitor bounds
1150   monitorbounds = window->monitor->info.rcMonitor;
1188   monitorbounds = window->m_monitor->info.rcMonitor;
11511189
11521190   // create the window menu if needed
11531191   if (downcast<windows_options &>(window->machine().options()).menu())
r31541r31542
11571195   }
11581196
11591197   // create the window, but don't show it yet
1160   window->hwnd = win_create_window_ex_utf8(
1161                  window->fullscreen ? FULLSCREEN_STYLE_EX : WINDOW_STYLE_EX,
1198   window->m_hwnd = win_create_window_ex_utf8(
1199                  window->m_fullscreen ? FULLSCREEN_STYLE_EX : WINDOW_STYLE_EX,
11621200                  "MAME",
1163                  window->title,
1164                  window->fullscreen ? FULLSCREEN_STYLE : WINDOW_STYLE,
1201                  window->m_title,
1202                  window->m_fullscreen ? FULLSCREEN_STYLE : WINDOW_STYLE,
11651203                  monitorbounds.left + 20, monitorbounds.top + 20,
11661204                  monitorbounds.left + 100, monitorbounds.top + 100,
1167                  NULL,//(win_window_list != NULL) ? win_window_list->hwnd : NULL,
1205                  NULL,//(win_window_list != NULL) ? win_window_list->m_hwnd : NULL,
11681206                  menu,
11691207                  GetModuleHandle(NULL),
11701208                  NULL);
1171   if (window->hwnd == NULL)
1209   if (window->m_hwnd == NULL)
11721210      return 1;
11731211
11741212   // set window #0 as the focus window for all windows, required for D3D & multimonitor
1175   window->focus_hwnd = win_window_list->hwnd;
1213   window->m_focus_hwnd = win_window_list->m_hwnd;
11761214
11771215   // set a pointer back to us
1178   SetWindowLongPtr(window->hwnd, GWLP_USERDATA, (LONG_PTR)window);
1216   SetWindowLongPtr(window->m_hwnd, GWLP_USERDATA, (LONG_PTR)window);
11791217
11801218   // skip the positioning stuff for -video none */
11811219   if (video_config.mode == VIDEO_MODE_NONE)
11821220      return 0;
11831221
11841222   // adjust the window position to the initial width/height
1185   tempwidth = (window->maxwidth != 0) ? window->maxwidth : 640;
1186   tempheight = (window->maxheight != 0) ? window->maxheight : 480;
1187   SetWindowPos(window->hwnd, NULL, monitorbounds.left + 20, monitorbounds.top + 20,
1223   tempwidth = (window->m_maxwidth != 0) ? window->m_maxwidth : 640;
1224   tempheight = (window->m_maxheight != 0) ? window->m_maxheight : 480;
1225   SetWindowPos(window->m_hwnd, NULL, monitorbounds.left + 20, monitorbounds.top + 20,
11881226         monitorbounds.left + tempwidth + wnd_extra_width(window),
11891227         monitorbounds.top + tempheight + wnd_extra_height(window),
11901228         SWP_NOZORDER);
11911229
11921230   // maximum or minimize as appropriate
1193   if (window->startmaximized)
1231   if (window->m_startmaximized)
11941232      maximize_window(window);
11951233   else
11961234      minimize_window(window);
11971235   adjust_window_position_after_major_change(window);
11981236
11991237   // show the window
1200   if (!window->fullscreen || window->fullscreen_safe)
1238   if (!window->m_fullscreen || window->m_fullscreen_safe)
12011239   {
12021240      // finish off by trying to initialize DirectX; if we fail, ignore it
12031241      if ((*draw.window_init)(window))
12041242         return 1;
1205      ShowWindow(window->hwnd, SW_SHOW);
1243      ShowWindow(window->m_hwnd, SW_SHOW);
12061244   }
12071245
12081246   // clear the window
1209   dc = GetDC(window->hwnd);
1210   GetClientRect(window->hwnd, &client);
1247   dc = GetDC(window->m_hwnd);
1248   GetClientRect(window->m_hwnd, &client);
12111249   FillRect(dc, &client, (HBRUSH)GetStockObject(BLACK_BRUSH));
1212   ReleaseDC(window->hwnd, dc);
1250   ReleaseDC(window->m_hwnd, dc);
12131251   return 0;
12141252}
12151253
r31541r31542
12421280         HDC hdc = BeginPaint(wnd, &pstruct);
12431281         draw_video_contents(window, hdc, TRUE);
12441282         if (win_has_menu(window))
1245            DrawMenuBar(window->hwnd);
1283            DrawMenuBar(window->m_hwnd);
12461284         EndPaint(wnd, &pstruct);
12471285         break;
12481286      }
12491287
12501288      // non-client paint: punt if full screen
12511289      case WM_NCPAINT:
1252         if (!window->fullscreen || win_has_menu(window))
1290         if (!window->m_fullscreen || win_has_menu(window))
12531291            return DefWindowProc(wnd, message, wparam, lparam);
12541292         break;
12551293
r31541r31542
12651303
12661304      // input events
12671305      case WM_MOUSEMOVE:
1268         ui_input_push_mouse_move_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
1306         ui_input_push_mouse_move_event(window->machine(), window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
12691307         break;
12701308
12711309      case WM_MOUSELEAVE:
1272         ui_input_push_mouse_leave_event(window->machine(), window->target);
1310         ui_input_push_mouse_leave_event(window->machine(), window->m_target);
12731311         break;
12741312
12751313      case WM_LBUTTONDOWN:
12761314      {
12771315         DWORD ticks = GetTickCount();
1278         ui_input_push_mouse_down_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
1316         ui_input_push_mouse_down_event(window->machine(), window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
12791317
12801318         // check for a double-click
1281         if (ticks - window->lastclicktime < GetDoubleClickTime() &&
1282            GET_X_LPARAM(lparam) >= window->lastclickx - 4 && GET_X_LPARAM(lparam) <= window->lastclickx + 4 &&
1283            GET_Y_LPARAM(lparam) >= window->lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->lastclicky + 4)
1319         if (ticks - window->m_lastclicktime < GetDoubleClickTime() &&
1320            GET_X_LPARAM(lparam) >= window->m_lastclickx - 4 && GET_X_LPARAM(lparam) <= window->m_lastclickx + 4 &&
1321            GET_Y_LPARAM(lparam) >= window->m_lastclicky - 4 && GET_Y_LPARAM(lparam) <= window->m_lastclicky + 4)
12841322         {
1285            window->lastclicktime = 0;
1286            ui_input_push_mouse_double_click_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
1323            window->m_lastclicktime = 0;
1324            ui_input_push_mouse_double_click_event(window->machine(), window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
12871325         }
12881326         else
12891327         {
1290            window->lastclicktime = ticks;
1291            window->lastclickx = GET_X_LPARAM(lparam);
1292            window->lastclicky = GET_Y_LPARAM(lparam);
1328            window->m_lastclicktime = ticks;
1329            window->m_lastclickx = GET_X_LPARAM(lparam);
1330            window->m_lastclicky = GET_Y_LPARAM(lparam);
12931331         }
12941332         break;
12951333      }
12961334
12971335      case WM_LBUTTONUP:
1298         ui_input_push_mouse_up_event(window->machine(), window->target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
1336         ui_input_push_mouse_up_event(window->machine(), window->m_target, GET_X_LPARAM(lparam), GET_Y_LPARAM(lparam));
12991337         break;
13001338
13011339      case WM_CHAR:
1302         ui_input_push_char_event(window->machine(), window->target, (unicode_char) wparam);
1340         ui_input_push_char_event(window->machine(), window->m_target, (unicode_char) wparam);
13031341         break;
13041342
13051343      // pause the system when we start a menu or resize
13061344      case WM_ENTERSIZEMOVE:
1307         window->resize_state = RESIZE_STATE_RESIZING;
1345         window->m_resize_state = RESIZE_STATE_RESIZING;
13081346      case WM_ENTERMENULOOP:
13091347         winwindow_ui_pause_from_window_thread(window->machine(), TRUE);
13101348         break;
13111349
13121350      // unpause the system when we stop a menu or resize and force a redraw
13131351      case WM_EXITSIZEMOVE:
1314         window->resize_state = RESIZE_STATE_PENDING;
1352         window->m_resize_state = RESIZE_STATE_PENDING;
13151353      case WM_EXITMENULOOP:
13161354         winwindow_ui_pause_from_window_thread(window->machine(), FALSE);
13171355         InvalidateRect(wnd, NULL, FALSE);
r31541r31542
13521390         if (cmd == SC_MAXIMIZE)
13531391         {
13541392            update_minmax_state(window);
1355            if (window->ismaximized)
1393            if (window->m_ismaximized)
13561394               minimize_window(window);
13571395            else
13581396               maximize_window(window);
r31541r31542
13771415      // destroy: clean up all attached rendering bits and NULL out our hwnd
13781416      case WM_DESTROY:
13791417         (*draw.window_destroy)(window);
1380         window->hwnd = NULL;
1418         window->m_hwnd = NULL;
13811419         return DefWindowProc(wnd, message, wparam, lparam);
13821420
13831421      // self redraw: draw ourself in a non-painty way
r31541r31542
13861424         HDC hdc = GetDC(wnd);
13871425
13881426         mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW begin");
1389         window->primlist = (render_primitive_list *)lparam;
1427         window->m_primlist = (render_primitive_list *)lparam;
13901428         draw_video_contents(window, hdc, FALSE);
13911429         mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW end");
13921430
r31541r31542
13961434
13971435      // self destruct
13981436      case WM_USER_SELF_TERMINATE:
1399         DestroyWindow(window->hwnd);
1437         DestroyWindow(window->m_hwnd);
14001438         break;
14011439
14021440      // fullscreen set
r31541r31542
14181456      // commented out ATM because this prevents us from resizing secondary windows
14191457//      case WM_SETFOCUS:
14201458//          if (window != win_window_list && win_window_list != NULL)
1421//              SetFocus(win_window_list->hwnd);
1459//              SetFocus(win_window_list->m_hwnd);
14221460//          break;
14231461
14241462      // everything else: defaults
r31541r31542
14431481   mtlog_add("draw_video_contents: begin");
14441482
14451483   mtlog_add("draw_video_contents: render lock acquire");
1446   osd_lock_acquire(window->render_lock);
1484   osd_lock_acquire(window->m_render_lock);
14471485   mtlog_add("draw_video_contents: render lock acquired");
14481486
14491487   // if we're iconic, don't bother
1450   if (window->hwnd != NULL && !IsIconic(window->hwnd))
1488   if (window->m_hwnd != NULL && !IsIconic(window->m_hwnd))
14511489   {
14521490      // if no bitmap, just fill
1453      if (window->primlist == NULL)
1491      if (window->m_primlist == NULL)
14541492      {
14551493         RECT fill;
1456         GetClientRect(window->hwnd, &fill);
1494         GetClientRect(window->m_hwnd, &fill);
14571495         FillRect(dc, &fill, (HBRUSH)GetStockObject(BLACK_BRUSH));
14581496      }
14591497
r31541r31542
14651503      }
14661504   }
14671505
1468   osd_lock_release(window->render_lock);
1506   osd_lock_release(window->m_render_lock);
14691507   mtlog_add("draw_video_contents: render lock released");
14701508
14711509   mtlog_add("draw_video_contents: end");
r31541r31542
15051543   {
15061544      case WMSZ_BOTTOM:
15071545      case WMSZ_TOP:
1508         window->target->compute_visible_area(10000, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
1546         window->m_target->compute_visible_area(10000, propheight, pixel_aspect, window->m_target->orientation(), propwidth, propheight);
15091547         break;
15101548
15111549      case WMSZ_LEFT:
15121550      case WMSZ_RIGHT:
1513         window->target->compute_visible_area(propwidth, 10000, pixel_aspect, window->target->orientation(), propwidth, propheight);
1551         window->m_target->compute_visible_area(propwidth, 10000, pixel_aspect, window->m_target->orientation(), propwidth, propheight);
15141552         break;
15151553
15161554      default:
1517         window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
1555         window->m_target->compute_visible_area(propwidth, propheight, pixel_aspect, window->m_target->orientation(), propwidth, propheight);
15181556         break;
15191557   }
15201558
15211559   // get the minimum width/height for the current layout
1522   window->target->compute_minimum_size(minwidth, minheight);
1560   window->m_target->compute_minimum_size(minwidth, minheight);
15231561
15241562   // clamp against the absolute minimum
15251563   propwidth = MAX(propwidth, MIN_WINDOW_DIM);
r31541r31542
15301568   propheight = MAX(propheight, minheight);
15311569
15321570   // clamp against the maximum (fit on one screen for full screen mode)
1533   if (window->fullscreen)
1571   if (window->m_fullscreen)
15341572   {
15351573      maxwidth = rect_width(&monitor->info.rcMonitor) - extrawidth;
15361574      maxheight = rect_height(&monitor->info.rcMonitor) - extraheight;
r31541r31542
15411579      maxheight = rect_height(&monitor->info.rcWork) - extraheight;
15421580
15431581      // further clamp to the maximum width/height in the window
1544      if (window->maxwidth != 0)
1545         maxwidth = MIN(maxwidth, window->maxwidth + extrawidth);
1546      if (window->maxheight != 0)
1547         maxheight = MIN(maxheight, window->maxheight + extraheight);
1582      if (window->m_maxwidth != 0)
1583         maxwidth = MIN(maxwidth, window->m_maxwidth + extrawidth);
1584      if (window->m_maxheight != 0)
1585         maxheight = MIN(maxheight, window->m_maxheight + extraheight);
15481586   }
15491587
15501588   // clamp to the maximum
r31541r31542
15521590   propheight = MIN(propheight, maxheight);
15531591
15541592   // compute the visible area based on the proposed rectangle
1555   window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), viswidth, visheight);
1593   window->m_target->compute_visible_area(propwidth, propheight, pixel_aspect, window->m_target->orientation(), viswidth, visheight);
15561594
15571595   // compute the adjustments we need to make
15581596   adjwidth = (viswidth + extrawidth) - rect_width(rect);
r31541r31542
16011639   assert(GetCurrentThreadId() == window_threadid);
16021640
16031641   // get the minimum target size
1604   window->target->compute_minimum_size(minwidth, minheight);
1642   window->m_target->compute_minimum_size(minwidth, minheight);
16051643
16061644   // expand to our minimum dimensions
16071645   if (minwidth < MIN_WINDOW_DIM)
r31541r31542
16441682   }
16451683
16461684   // get the window rect
1647   GetWindowRect(window->hwnd, bounds);
1685   GetWindowRect(window->m_hwnd, bounds);
16481686
16491687   // now adjust
16501688   bounds->right = bounds->left + minwidth;
r31541r31542
16651703   assert(GetCurrentThreadId() == window_threadid);
16661704
16671705   // compute the maximum client area
1668   window->monitor->refresh();
1669   maximum = window->monitor->info.rcWork;
1706   window->m_monitor->refresh();
1707   maximum = window->m_monitor->info.rcWork;
16701708
16711709   // clamp to the window's max
1672   if (window->maxwidth != 0)
1710   if (window->m_maxwidth != 0)
16731711   {
1674      int temp = window->maxwidth + wnd_extra_width(window);
1712      int temp = window->m_maxwidth + wnd_extra_width(window);
16751713      if (temp < rect_width(&maximum))
16761714         maximum.right = maximum.left + temp;
16771715   }
1678   if (window->maxheight != 0)
1716   if (window->m_maxheight != 0)
16791717   {
1680      int temp = window->maxheight + wnd_extra_height(window);
1718      int temp = window->m_maxheight + wnd_extra_height(window);
16811719      if (temp < rect_height(&maximum))
16821720         maximum.bottom = maximum.top + temp;
16831721   }
r31541r31542
16921730   }
16931731
16941732   // center within the work area
1695   bounds->left = window->monitor->info.rcWork.left + (rect_width(&window->monitor->info.rcWork) - rect_width(&maximum)) / 2;
1696   bounds->top = window->monitor->info.rcWork.top + (rect_height(&window->monitor->info.rcWork) - rect_height(&maximum)) / 2;
1733   bounds->left = window->m_monitor->info.rcWork.left + (rect_width(&window->m_monitor->info.rcWork) - rect_width(&maximum)) / 2;
1734   bounds->top = window->m_monitor->info.rcWork.top + (rect_height(&window->m_monitor->info.rcWork) - rect_height(&maximum)) / 2;
16971735   bounds->right = bounds->left + rect_width(&maximum);
16981736   bounds->bottom = bounds->top + rect_height(&maximum);
16991737}
r31541r31542
17091747{
17101748   assert(GetCurrentThreadId() == window_threadid);
17111749
1712   if (!window->fullscreen)
1750   if (!window->m_fullscreen)
17131751   {
17141752      RECT bounds, minbounds, maxbounds;
17151753
17161754      // compare the maximum bounds versus the current bounds
17171755      get_min_bounds(window, &minbounds, video_config.keepaspect);
17181756      get_max_bounds(window, &maxbounds, video_config.keepaspect);
1719      GetWindowRect(window->hwnd, &bounds);
1757      GetWindowRect(window->m_hwnd, &bounds);
17201758
17211759      // if either the width or height matches, we were maximized
1722      window->isminimized = (rect_width(&bounds) == rect_width(&minbounds) ||
1760      window->m_isminimized = (rect_width(&bounds) == rect_width(&minbounds) ||
17231761                        rect_height(&bounds) == rect_height(&minbounds));
1724      window->ismaximized = (rect_width(&bounds) == rect_width(&maxbounds) ||
1762      window->m_ismaximized = (rect_width(&bounds) == rect_width(&maxbounds) ||
17251763                        rect_height(&bounds) == rect_height(&maxbounds));
17261764   }
17271765   else
17281766   {
1729      window->isminimized = FALSE;
1730      window->ismaximized = TRUE;
1767      window->m_isminimized = FALSE;
1768      window->m_ismaximized = TRUE;
17311769   }
17321770}
17331771
r31541r31542
17451783   assert(GetCurrentThreadId() == window_threadid);
17461784
17471785   get_min_bounds(window, &newsize, video_config.keepaspect);
1748   SetWindowPos(window->hwnd, NULL, newsize.left, newsize.top, rect_width(&newsize), rect_height(&newsize), SWP_NOZORDER);
1786   SetWindowPos(window->m_hwnd, NULL, newsize.left, newsize.top, rect_width(&newsize), rect_height(&newsize), SWP_NOZORDER);
17491787}
17501788
17511789
r31541r31542
17621800   assert(GetCurrentThreadId() == window_threadid);
17631801
17641802   get_max_bounds(window, &newsize, video_config.keepaspect);
1765   SetWindowPos(window->hwnd, NULL, newsize.left, newsize.top, rect_width(&newsize), rect_height(&newsize), SWP_NOZORDER);
1803   SetWindowPos(window->m_hwnd, NULL, newsize.left, newsize.top, rect_width(&newsize), rect_height(&newsize), SWP_NOZORDER);
17661804}
17671805
17681806
r31541r31542
17791817   assert(GetCurrentThreadId() == window_threadid);
17801818
17811819   // get the current size
1782   GetWindowRect(window->hwnd, &oldrect);
1820   GetWindowRect(window->m_hwnd, &oldrect);
17831821
17841822   // adjust the window size so the client area is what we want
1785   if (!window->fullscreen)
1823   if (!window->m_fullscreen)
17861824   {
17871825      // constrain the existing size to the aspect ratio
17881826      newrect = oldrect;
r31541r31542
18001838   // adjust the position if different
18011839   if (oldrect.left != newrect.left || oldrect.top != newrect.top ||
18021840      oldrect.right != newrect.right || oldrect.bottom != newrect.bottom)
1803      SetWindowPos(window->hwnd, window->fullscreen ? HWND_TOPMOST : HWND_TOP,
1841      SetWindowPos(window->m_hwnd, window->m_fullscreen ? HWND_TOPMOST : HWND_TOP,
18041842            newrect.left, newrect.top,
18051843            rect_width(&newrect), rect_height(&newrect), 0);
18061844
r31541r31542
18251863   assert(GetCurrentThreadId() == window_threadid);
18261864
18271865   // if we're in the right state, punt
1828   if (window->fullscreen == fullscreen)
1866   if (window->m_fullscreen == fullscreen)
18291867      return;
1830   window->fullscreen = fullscreen;
1868   window->m_fullscreen = fullscreen;
18311869
18321870   // kill off the drawers
18331871   (*draw.window_destroy)(window);
18341872
18351873   // hide ourself
1836   ShowWindow(window->hwnd, SW_HIDE);
1874   ShowWindow(window->m_hwnd, SW_HIDE);
18371875
18381876   // configure the window if non-fullscreen
18391877   if (!fullscreen)
18401878   {
18411879      // adjust the style
1842      SetWindowLong(window->hwnd, GWL_STYLE, WINDOW_STYLE);
1843      SetWindowLong(window->hwnd, GWL_EXSTYLE, WINDOW_STYLE_EX);
1844      SetWindowPos(window->hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
1880      SetWindowLong(window->m_hwnd, GWL_STYLE, WINDOW_STYLE);
1881      SetWindowLong(window->m_hwnd, GWL_EXSTYLE, WINDOW_STYLE_EX);
1882      SetWindowPos(window->m_hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
18451883
18461884      // force to the bottom, then back on top
1847      SetWindowPos(window->hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
1848      SetWindowPos(window->hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
1885      SetWindowPos(window->m_hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
1886      SetWindowPos(window->m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
18491887
18501888      // if we have previous non-fullscreen bounds, use those
1851      if (window->non_fullscreen_bounds.right != window->non_fullscreen_bounds.left)
1889      if (window->m_non_fullscreen_bounds.right != window->m_non_fullscreen_bounds.left)
18521890      {
1853         SetWindowPos(window->hwnd, HWND_TOP, window->non_fullscreen_bounds.left, window->non_fullscreen_bounds.top,
1854                  rect_width(&window->non_fullscreen_bounds), rect_height(&window->non_fullscreen_bounds),
1891         SetWindowPos(window->m_hwnd, HWND_TOP, window->m_non_fullscreen_bounds.left, window->m_non_fullscreen_bounds.top,
1892                  rect_width(&window->m_non_fullscreen_bounds), rect_height(&window->m_non_fullscreen_bounds),
18551893                  SWP_NOZORDER);
18561894      }
18571895
18581896      // otherwise, set a small size and maximize from there
18591897      else
18601898      {
1861         SetWindowPos(window->hwnd, HWND_TOP, 0, 0, MIN_WINDOW_DIM, MIN_WINDOW_DIM, SWP_NOZORDER);
1899         SetWindowPos(window->m_hwnd, HWND_TOP, 0, 0, MIN_WINDOW_DIM, MIN_WINDOW_DIM, SWP_NOZORDER);
18621900         maximize_window(window);
18631901      }
18641902   }
r31541r31542
18671905   else
18681906   {
18691907      // save the bounds
1870      GetWindowRect(window->hwnd, &window->non_fullscreen_bounds);
1908      GetWindowRect(window->m_hwnd, &window->m_non_fullscreen_bounds);
18711909
18721910      // adjust the style
1873      SetWindowLong(window->hwnd, GWL_STYLE, FULLSCREEN_STYLE);
1874      SetWindowLong(window->hwnd, GWL_EXSTYLE, FULLSCREEN_STYLE_EX);
1875      SetWindowPos(window->hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
1911      SetWindowLong(window->m_hwnd, GWL_STYLE, FULLSCREEN_STYLE);
1912      SetWindowLong(window->m_hwnd, GWL_EXSTYLE, FULLSCREEN_STYLE_EX);
1913      SetWindowPos(window->m_hwnd, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
18761914
18771915      // set topmost
1878      SetWindowPos(window->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
1916      SetWindowPos(window->m_hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
18791917   }
18801918
18811919   // adjust the window to compensate for the change
18821920   adjust_window_position_after_major_change(window);
18831921
18841922   // show ourself
1885   if (!window->fullscreen || window->fullscreen_safe)
1923   if (!window->m_fullscreen || window->m_fullscreen_safe)
18861924   {
18871925      if (video_config.mode != VIDEO_MODE_NONE)
1888         ShowWindow(window->hwnd, SW_SHOW);
1926         ShowWindow(window->m_hwnd, SW_SHOW);
18891927      if ((*draw.window_init)(window))
18901928         exit(1);
18911929   }
branches/osd/src/osd/windows/window.h
r31541r31542
3232//  TYPE DEFINITIONS
3333//============================================================
3434
35struct win_window_info
35class win_window_info
3636{
3737public:
38   win_window_info(running_machine &machine)
39      : m_machine(machine) { }
38   win_window_info(running_machine &machine);
39   virtual ~win_window_info();     
4040
4141   running_machine &machine() const { return m_machine; }
4242
43   win_window_info *   next;
44   volatile int        init_state;
43   void update();
44   
45   win_window_info *   m_next;
46   volatile int        m_init_state;
4547
4648   // window handle and info
47   HWND                hwnd;
48   HWND                focus_hwnd;
49   char                title[256];
50   RECT                non_fullscreen_bounds;
51   int                 startmaximized;
52   int                 isminimized;
53   int                 ismaximized;
54   int                 resize_state;
49   HWND                m_hwnd;
50   HWND                m_focus_hwnd;
51   char                m_title[256];
52   RECT                m_non_fullscreen_bounds;
53   int                 m_startmaximized;
54   int                 m_isminimized;
55   int                 m_ismaximized;
56   int                 m_resize_state;
5557
5658   // monitor info
57   win_monitor_info *  monitor;
58   int                 fullscreen;
59   int                 fullscreen_safe;
60   int                 maxwidth, maxheight;
61   int                 refresh;
62   float               aspect;
59   win_monitor_info *  m_monitor;
60   int                 m_fullscreen;
61   int                 m_fullscreen_safe;
62   int                 m_maxwidth, m_maxheight;
63   int                 m_refresh;
64   float               m_aspect;
6365
6466   // rendering info
65   osd_lock *          render_lock;
66   render_target *     target;
67   int                 targetview;
68   int                 targetorient;
69   render_layer_config targetlayerconfig;
70   render_primitive_list *primlist;
67   osd_lock *          m_render_lock;
68   render_target *     m_target;
69   int                 m_targetview;
70   int                 m_targetorient;
71   render_layer_config m_targetlayerconfig;
72   render_primitive_list *m_primlist;
7173
7274   // input info
73   DWORD               lastclicktime;
74   int                 lastclickx;
75   int                 lastclicky;
75   DWORD               m_lastclicktime;
76   int                 m_lastclickx;
77   int                 m_lastclicky;
7678
7779   // drawing data
78   void *              drawdata;
80   void *              m_drawdata;
7981
8082private:
8183   running_machine &   m_machine;
r31541r31542
115117
116118BOOL winwindow_has_focus(void);
117119void winwindow_update_cursor_state(running_machine &machine);
118void winwindow_video_window_update(win_window_info *window);
119120win_monitor_info *winwindow_video_window_monitor(win_window_info *window, const RECT *proposed);
120121
121122LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wparam, LPARAM lparam);
r31541r31542
146147
147148INLINE BOOL win_has_menu(win_window_info *window)
148149{
149   return GetMenu(window->hwnd) ? TRUE : FALSE;
150   return GetMenu(window->m_hwnd) ? TRUE : FALSE;
150151}
151152
152153
branches/osd/src/osd/windows/drawd3d.c
r31541r31542
196196{
197197   // allocate memory for our structures
198198   d3d::renderer *d3d = global_alloc(d3d::renderer(window));
199   window->drawdata = d3d;
199   window->m_drawdata = d3d;
200200
201201   if (!d3d->initialize())
202202   {
r31541r31542
220220
221221static void drawd3d_window_toggle_fsfx(win_window_info *window)
222222{
223   d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
223   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
224224   d3d->set_restarting(true);
225225}
226226
227227static void drawd3d_window_record(win_window_info *window)
228228{
229   d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
229   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
230230   d3d->get_shaders()->window_record();
231231}
232232
233233static void drawd3d_window_save(win_window_info *window)
234234{
235   d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
235   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
236236   d3d->get_shaders()->window_save();
237237}
238238
r31541r31542
244244
245245static void drawd3d_window_destroy(win_window_info *window)
246246{
247   d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
247   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
248248
249249   // skip if nothing
250250   if (d3d == NULL)
r31541r31542
255255
256256   // free the memory in the window
257257   global_free(d3d);
258   window->drawdata = NULL;
258   window->m_drawdata = NULL;
259259}
260260
261261
r31541r31542
266266
267267static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window)
268268{
269   d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
269   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
270270   RECT client;
271271
272   GetClientRectExceptMenu(window->hwnd, &client, window->fullscreen);
272   GetClientRectExceptMenu(window->m_hwnd, &client, window->m_fullscreen);
273273   if (rect_width(&client) > 0 && rect_height(&client) > 0)
274274   {
275      window->target->set_bounds(rect_width(&client), rect_height(&client), window->monitor->get_aspect());
276      window->target->set_max_update_rate((d3d->get_refresh() == 0) ? d3d->get_origmode().RefreshRate : d3d->get_refresh());
275      window->m_target->set_bounds(rect_width(&client), rect_height(&client), window->m_monitor->get_aspect());
276      window->m_target->set_max_update_rate((d3d->get_refresh() == 0) ? d3d->get_origmode().RefreshRate : d3d->get_refresh());
277277   }
278   return &window->target->get_primitives();
278   return &window->m_target->get_primitives();
279279}
280280
281281int drawd3d_init(running_machine &machine, win_draw_callbacks *callbacks)
r31541r31542
311311
312312static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
313313{
314   d3d::renderer *d3d = (d3d::renderer *)window->drawdata;
314   d3d::renderer *d3d = (d3d::renderer *)window->m_drawdata;
315315
316316   // if we haven't been created, just punt
317317   if (d3d == NULL)
r31541r31542
496496   osd_printf_verbose("Direct3D: YUV format = %s\n", (m_yuv_format == D3DFMT_YUY2) ? "YUY2" : (m_yuv_format == D3DFMT_UYVY) ? "UYVY" : "RGB");
497497
498498   // set the max texture size
499   d3d->get_window()->target->set_max_texture_size(m_texture_max_width, m_texture_max_height);
499   d3d->get_window()->m_target->set_max_texture_size(m_texture_max_width, m_texture_max_height);
500500   osd_printf_verbose("Direct3D: Max texture size = %dx%d\n", (int)m_texture_max_width, (int)m_texture_max_height);
501501}
502502
r31541r31542
672672      return false;
673673
674674   // create the device immediately for the full screen case (defer for window mode)
675   if (m_window->fullscreen && device_create())
675   if (m_window->m_fullscreen && device_create())
676676      return false;
677677
678678   return true;
r31541r31542
681681int renderer::pre_window_draw_check()
682682{
683683   // if we're in the middle of resizing, leave things alone
684   if (m_window->resize_state == RESIZE_STATE_RESIZING)
684   if (m_window->m_resize_state == RESIZE_STATE_RESIZING)
685685      return 0;
686686
687687   // if we're restarting the renderer, leave things alone
r31541r31542
706706   }
707707
708708   // in window mode, we need to track the window size
709   if (!m_window->fullscreen || m_device == NULL)
709   if (!m_window->m_fullscreen || m_device == NULL)
710710   {
711711      // if the size changes, skip this update since the render target will be out of date
712712      if (update_window_size())
r31541r31542
722722
723723void texture_manager::update_textures()
724724{
725   for (render_primitive *prim = m_renderer->get_window()->primlist->first(); prim != NULL; prim = prim->next())
725   for (render_primitive *prim = m_renderer->get_window()->m_primlist->first(); prim != NULL; prim = prim->next())
726726   {
727727      if (prim->texture.base != NULL)
728728      {
r31541r31542
759759
760760   m_shaders->begin_frame();
761761
762   m_window->primlist->acquire_lock();
762   m_window->m_primlist->acquire_lock();
763763
764764   // first update any textures
765765   m_texture_manager->update_textures();
r31541r31542
780780   m_line_count = 0;
781781
782782   // loop over primitives
783   for (render_primitive *prim = m_window->primlist->first(); prim != NULL; prim = prim->next())
783   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
784784      if (prim->type == render_primitive::LINE && PRIMFLAG_GET_VECTOR(prim->flags))
785785         m_line_count++;
786786}
r31541r31542
788788void renderer::process_primitives()
789789{
790790   // Rotating index for vector time offsets
791   for (render_primitive *prim = m_window->primlist->first(); prim != NULL; prim = prim->next())
791   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
792792   {
793793      switch (prim->type)
794794      {
r31541r31542
818818
819819void renderer::end_frame()
820820{
821   m_window->primlist->release_lock();
821   m_window->m_primlist->release_lock();
822822
823823   // flush any pending polygons
824824   primitive_flush_pending();
r31541r31542
893893   m_presentation.BackBufferCount               = video_config.triplebuf ? 2 : 1;
894894   m_presentation.MultiSampleType               = D3DMULTISAMPLE_NONE;
895895   m_presentation.SwapEffect                    = D3DSWAPEFFECT_DISCARD;
896   m_presentation.hDeviceWindow                 = m_window->hwnd;
897   m_presentation.Windowed                      = !m_window->fullscreen || win_has_menu(m_window);
896   m_presentation.hDeviceWindow                 = m_window->m_hwnd;
897   m_presentation.Windowed                      = !m_window->m_fullscreen || win_has_menu(m_window);
898898   m_presentation.EnableAutoDepthStencil        = FALSE;
899899   m_presentation.AutoDepthStencilFormat        = D3DFMT_D16;
900900   m_presentation.Flags                         = 0;
901901   m_presentation.FullScreen_RefreshRateInHz    = m_refresh;
902   m_presentation.PresentationInterval          = ((video_config.triplebuf && m_window->fullscreen) ||
902   m_presentation.PresentationInterval          = ((video_config.triplebuf && m_window->m_fullscreen) ||
903903                                       video_config.waitvsync || video_config.syncrefresh) ?
904904                                       D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
905905
906906   // create the D3D device
907   result = (*d3dintf->d3d.create_device)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_window->focus_hwnd,
907   result = (*d3dintf->d3d.create_device)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_window->m_focus_hwnd,
908908               D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_FPU_PRESERVE, &m_presentation, &m_device);
909909   if (result != D3D_OK)
910910   {
r31541r31542
927927   osd_printf_verbose("Direct3D: Device created at %dx%d\n", m_width, m_height);
928928
929929   // set the gamma if we need to
930   if (m_window->fullscreen)
930   if (m_window->m_fullscreen)
931931   {
932932      // only set the gamma if it's not 1.0f
933933      windows_options &options = downcast<windows_options &>(m_window->machine().options());
r31541r31542
12271227   }
12281228
12291229   // choose a resolution: window mode case
1230   if (!m_window->fullscreen || !video_config.switchres || win_has_menu(m_window))
1230   if (!m_window->m_fullscreen || !video_config.switchres || win_has_menu(m_window))
12311231   {
12321232      RECT client;
12331233
12341234      // bounds are from the window client rect
1235      GetClientRectExceptMenu(m_window->hwnd, &client, m_window->fullscreen);
1235      GetClientRectExceptMenu(m_window->m_hwnd, &client, m_window->m_fullscreen);
12361236      m_width = client.right - client.left;
12371237      m_height = client.bottom - client.top;
12381238
r31541r31542
12431243      // make sure it's a pixel format we can get behind
12441244      if (m_pixformat != D3DFMT_X1R5G5B5 && m_pixformat != D3DFMT_R5G6B5 && m_pixformat != D3DFMT_X8R8G8B8)
12451245      {
1246         char *utf8_device = utf8_from_tstring(m_window->monitor->info.szDevice);
1246         char *utf8_device = utf8_from_tstring(m_window->m_monitor->info.szDevice);
12471247         if (utf8_device != NULL)
12481248         {
12491249            osd_printf_error("Device %s currently in an unsupported mode\n", utf8_device);
r31541r31542
12681268   }
12691269
12701270   // see if we can handle the device type
1271   result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !m_window->fullscreen);
1271   result = (*d3dintf->d3d.check_device_type)(d3dintf, m_adapter, D3DDEVTYPE_HAL, m_pixformat, m_pixformat, !m_window->m_fullscreen);
12721272   if (result != D3D_OK)
12731273   {
1274      char *utf8_device = utf8_from_tstring(m_window->monitor->info.szDevice);
1274      char *utf8_device = utf8_from_tstring(m_window->m_monitor->info.szDevice);
12751275      if (utf8_device != NULL)
12761276      {
12771277         osd_printf_error("Proposed video mode not supported on device %s\n", utf8_device);
r31541r31542
12991299      HMONITOR curmonitor = (*d3dintf->d3d.get_adapter_monitor)(d3dintf, adapternum);
13001300
13011301      // if we match the proposed monitor, this is it
1302      if (curmonitor == m_window->monitor->handle)
1302      if (curmonitor == m_window->m_monitor->handle)
13031303      {
13041304         return adapternum;
13051305      }
r31541r31542
13321332   // note: technically we should not be calling this from an alternate window
13331333   // thread; however, it is only done during init time, and the init code on
13341334   // the main thread is waiting for us to finish, so it is safe to do so here
1335   m_window->target->compute_minimum_size(minwidth, minheight);
1335   m_window->m_target->compute_minimum_size(minwidth, minheight);
13361336
13371337   // use those as the target for now
13381338   INT32 target_width = minwidth;
r31541r31542
13671367         size_score *= 0.1f;
13681368
13691369      // if we're looking for a particular mode, that's a winner
1370      if (mode.Width == m_window->maxwidth && mode.Height == m_window->maxheight)
1370      if (mode.Width == m_window->m_maxwidth && mode.Height == m_window->m_maxheight)
13711371         size_score = 2.0f;
13721372
13731373      // compute refresh score
r31541r31542
13781378         refresh_score *= 0.1f;
13791379
13801380      // if we're looking for a particular refresh, make sure it matches
1381      if (mode.RefreshRate == m_window->refresh)
1381      if (mode.RefreshRate == m_window->m_refresh)
13821382         refresh_score = 2.0f;
13831383
13841384      // weight size and refresh equally
r31541r31542
14081408{
14091409   // get the current window bounds
14101410   RECT client;
1411   GetClientRectExceptMenu(m_window->hwnd, &client, m_window->fullscreen);
1411   GetClientRectExceptMenu(m_window->m_hwnd, &client, m_window->m_fullscreen);
14121412
14131413   // if we have a device and matching width/height, nothing to do
14141414   if (m_device != NULL && rect_width(&client) == m_width && rect_height(&client) == m_height)
14151415   {
14161416      // clear out any pending resizing if the area didn't change
1417      if (m_window->resize_state == RESIZE_STATE_PENDING)
1418         m_window->resize_state = RESIZE_STATE_NORMAL;
1417      if (m_window->m_resize_state == RESIZE_STATE_PENDING)
1418         m_window->m_resize_state = RESIZE_STATE_NORMAL;
14191419      return FALSE;
14201420   }
14211421
14221422   // if we're in the middle of resizing, leave it alone as well
1423   if (m_window->resize_state == RESIZE_STATE_RESIZING)
1423   if (m_window->m_resize_state == RESIZE_STATE_RESIZING)
14241424      return FALSE;
14251425
14261426   // set the new bounds and create the device again
r31541r31542
14301430      return FALSE;
14311431
14321432   // reset the resize state to normal, and indicate we made a change
1433   m_window->resize_state = RESIZE_STATE_NORMAL;
1433   m_window->m_resize_state = RESIZE_STATE_NORMAL;
14341434   return TRUE;
14351435}
14361436
r31541r31542
14501450   int line_index = 0;
14511451   float period = options.screen_vector_time_period();
14521452   UINT32 cached_flags = 0;
1453   for (render_primitive *prim = m_window->primlist->first(); prim != NULL; prim = prim->next())
1453   for (render_primitive *prim = m_window->m_primlist->first(); prim != NULL; prim = prim->next())
14541454   {
14551455      switch (prim->type)
14561456      {
branches/osd/src/osd/windows/d3dhlsl.c
r31541r31542
224224   if (!master_enable || !d3dintf->post_fx_available)
225225      return;
226226
227   renderer *d3d = (renderer *)window->drawdata;
227   renderer *d3d = (renderer *)window->m_drawdata;
228228
229229   HRESULT result = (*d3dintf->device.create_texture)(d3d->get_device(), snap_width, snap_height, 1, D3DUSAGE_DYNAMIC, D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &snap_copy_texture);
230230   if (result != D3D_OK)
r31541r31542
276276   if (!master_enable || !d3dintf->post_fx_available)
277277      return;
278278
279   renderer *d3d = (renderer *)window->drawdata;
279   renderer *d3d = (renderer *)window->m_drawdata;
280280
281281   D3DLOCKED_RECT rect;
282282
r31541r31542
326326   if (!master_enable || !d3dintf->post_fx_available)
327327      return;
328328
329   renderer *d3d = (renderer *)window->drawdata;
329   renderer *d3d = (renderer *)window->m_drawdata;
330330
331331   D3DLOCKED_RECT rect;
332332
r31541r31542
519519   if (!master_enable || !d3dintf->post_fx_available)
520520      return;
521521
522   renderer *d3d = (renderer *)window->drawdata;
522   renderer *d3d = (renderer *)window->m_drawdata;
523523
524524   // stop any existing recording
525525   end_avi_recording();
r31541r31542
678678   if (!master_enable || !d3dintf->post_fx_available)
679679      return;
680680
681   renderer *d3d = (renderer *)window->drawdata;
681   renderer *d3d = (renderer *)window->m_drawdata;
682682
683683   if(texture != NULL)
684684   {
r31541r31542
820820   if (!master_enable || !d3dintf->post_fx_available)
821821      return;
822822
823   renderer *d3d = (renderer *)window->drawdata;
823   renderer *d3d = (renderer *)window->m_drawdata;
824824
825825   // get a pointer to the vertex buffer
826826   fsfx_vertices = (vertex *)vertbuf;
r31541r31542
892892   if (!master_enable || !d3dintf->post_fx_available)
893893      return 0;
894894
895   renderer *d3d = (renderer *)window->drawdata;
895   renderer *d3d = (renderer *)window->m_drawdata;
896896
897897   HRESULT result = (*d3dintf->device.get_render_target)(d3d->get_device(), 0, &backbuffer);
898898   if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device get_render_target call\n", (int)result);
r31541r31542
10661066   if (!master_enable || !d3dintf->post_fx_available)
10671067      return;
10681068
1069   renderer *d3d = (renderer *)window->drawdata;
1069   renderer *d3d = (renderer *)window->m_drawdata;
10701070
10711071   curr_effect = default_effect;
10721072
r31541r31542
11011101void shaders::blit(surface *dst, texture *src, surface *new_dst, D3DPRIMITIVETYPE prim_type,
11021102                  UINT32 prim_index, UINT32 prim_count, int dstw, int dsth)
11031103{
1104   renderer *d3d = (renderer *)window->drawdata;
1104   renderer *d3d = (renderer *)window->m_drawdata;
11051105
11061106   HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, dst);
11071107   if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
r31541r31542
11461146void shaders::blit(surface *dst, texture *src, surface *new_dst, D3DPRIMITIVETYPE prim_type,
11471147                  UINT32 prim_index, UINT32 prim_count)
11481148{
1149   renderer *d3d = (renderer *)window->drawdata;
1149   renderer *d3d = (renderer *)window->m_drawdata;
11501150
11511151   HRESULT result = (*d3dintf->device.set_render_target)(d3d->get_device(), 0, dst);
11521152   if (result != D3D_OK) osd_printf_verbose("Direct3D: Error %08X during device set_render_target call\n", (int)result);
r31541r31542
12311231   if (!master_enable || !d3dintf->post_fx_available)
12321232      return;
12331233
1234   renderer *d3d = (renderer *)window->drawdata;
1234   renderer *d3d = (renderer *)window->m_drawdata;
12351235   texture_info *texture = poly->get_texture();
12361236
12371237   if(PRIMFLAG_GET_SCREENTEX(d3d->get_last_texture_flags()) && texture != NULL)
r31541r31542
13081308
13091309void shaders::ntsc_pass(render_target *rt, vec2f &sourcedims, vec2f &delta)
13101310{
1311   renderer *d3d = (renderer *)window->drawdata;
1311   renderer *d3d = (renderer *)window->m_drawdata;
13121312   UINT num_passes = 0;
13131313
13141314   if(options->yiq_enable)
r31541r31542
13701370
13711371void shaders::color_convolution_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims)
13721372{
1373   renderer *d3d = (renderer *)window->drawdata;
1373   renderer *d3d = (renderer *)window->m_drawdata;
13741374   UINT num_passes = 0;
13751375
13761376   curr_effect = color_effect;
r31541r31542
13981398
13991399void shaders::prescale_pass(render_target *rt, vec2f &texsize, vec2f &sourcedims)
14001400{
1401   renderer *d3d = (renderer *)window->drawdata;
1401   renderer *d3d = (renderer *)window->m_drawdata;
14021402   UINT num_passes = 0;
14031403
14041404   curr_effect = prescale_effect;
r31541r31542
14261426
14271427void shaders::deconverge_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims)
14281428{
1429   renderer *d3d = (renderer *)window->drawdata;
1429   renderer *d3d = (renderer *)window->m_drawdata;
14301430   UINT num_passes = 0;
14311431
14321432   curr_effect = deconverge_effect;
r31541r31542
14541454
14551455void shaders::defocus_pass(render_target *rt, vec2f &texsize)
14561456{
1457   renderer *d3d = (renderer *)window->drawdata;
1457   renderer *d3d = (renderer *)window->m_drawdata;
14581458   UINT num_passes = 0;
14591459
14601460   // Defocus pass 1
r31541r31542
15031503
15041504void shaders::phosphor_pass(render_target *rt, cache_target *ct, vec2f &texsize, bool focus_enable)
15051505{
1506   renderer *d3d = (renderer *)window->drawdata;
1506   renderer *d3d = (renderer *)window->m_drawdata;
15071507   UINT num_passes = 0;
15081508
15091509   curr_effect = phosphor_effect;
r31541r31542
15611561
15621562void shaders::avi_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum)
15631563{
1564   renderer *d3d = (renderer *)window->drawdata;
1564   renderer *d3d = (renderer *)window->m_drawdata;
15651565   UINT num_passes = 0;
15661566
15671567   curr_effect = post_effect;
r31541r31542
16161616
16171617void shaders::screen_post_pass(render_target *rt, vec2f &texsize, vec2f &delta, vec2f &sourcedims, poly_info *poly, int vertnum)
16181618{
1619   renderer *d3d = (renderer *)window->drawdata;
1619   renderer *d3d = (renderer *)window->m_drawdata;
16201620   UINT num_passes = 0;
16211621
16221622   curr_effect = post_effect;
r31541r31542
16501650
16511651void shaders::raster_bloom_pass(render_target *rt, vec2f &texsize, vec2f &delta, poly_info *poly, int vertnum)
16521652{
1653   renderer *d3d = (renderer *)window->drawdata;
1653   renderer *d3d = (renderer *)window->m_drawdata;
16541654   UINT num_passes = 0;
16551655
16561656   curr_effect = downsample_effect;
r31541r31542
17551755      return;
17561756
17571757   UINT num_passes = 0;
1758   renderer *d3d = (renderer *)window->drawdata;
1758   renderer *d3d = (renderer *)window->m_drawdata;
17591759   curr_texture = poly->get_texture();
17601760
17611761   if(PRIMFLAG_GET_SCREENTEX(d3d->get_last_texture_flags()) && curr_texture != NULL)
r31541r31542
20802080      return NULL;
20812081   }
20822082
2083   renderer *d3d = (renderer *)window->drawdata;
2083   renderer *d3d = (renderer *)window->m_drawdata;
20842084
20852085   return find_render_target(d3d->get_width(), d3d->get_height(), 0, 0);
20862086}
20872087
20882088void shaders::create_vector_target(render_primitive *prim)
20892089{
2090   renderer *d3d = (renderer *)window->drawdata;
2090   renderer *d3d = (renderer *)window->m_drawdata;
20912091   if (!add_render_target(d3d, NULL, d3d->get_width(), d3d->get_height(), 1, 1))
20922092   {
20932093      vector_enable = false;
r31541r31542
22022202
22032203   enumerate_screens();
22042204
2205   renderer *d3d = (renderer *)window->drawdata;
2205   renderer *d3d = (renderer *)window->m_drawdata;
22062206
22072207   int hlsl_prescale_x = prescale_force_x;
22082208   int hlsl_prescale_y = prescale_force_y;
r31541r31542
29942994   }
29952995
29962996   shaders *shadersys = m_shader->m_shaders;
2997   renderer *d3d = (renderer *)shadersys->window->drawdata;
2997   renderer *d3d = (renderer *)shadersys->window->m_drawdata;
29982998   hlsl_options *options = shadersys->options;
29992999
30003000   switch(m_id)
branches/osd/src/osd/windows/drawnone.c
r31541r31542
8787static render_primitive_list *drawnone_window_get_primitives(win_window_info *window)
8888{
8989   RECT client;
90   GetClientRect(window->hwnd, &client);
91   window->target->set_bounds(rect_width(&client), rect_height(&client), window->monitor->get_aspect());
92   return &window->target->get_primitives();
90   GetClientRect(window->m_hwnd, &client);
91   window->m_target->set_bounds(rect_width(&client), rect_height(&client), window->m_monitor->get_aspect());
92   return &window->m_target->get_primitives();
9393}
9494
9595
branches/osd/src/osd/windows/drawgdi.c
r31541r31542
8282{
8383   // allocate memory for our structures
8484   gdi_info *gdi = global_alloc_clear(gdi_info);
85   window->drawdata = gdi;
85   window->m_drawdata = gdi;
8686
8787   // fill in the bitmap info header
8888   gdi->bminfo.bmiHeader.biSize            = sizeof(gdi->bminfo.bmiHeader);
r31541r31542
106106
107107static void drawgdi_window_destroy(win_window_info *window)
108108{
109   gdi_info *gdi = (gdi_info *)window->drawdata;
109   gdi_info *gdi = (gdi_info *)window->m_drawdata;
110110
111111   // skip if nothing
112112   if (gdi == NULL)
r31541r31542
116116   if (gdi->bmdata != NULL)
117117      global_free_array(gdi->bmdata);
118118   global_free(gdi);
119   window->drawdata = NULL;
119   window->m_drawdata = NULL;
120120}
121121
122122
r31541r31542
128128static render_primitive_list *drawgdi_window_get_primitives(win_window_info *window)
129129{
130130   RECT client;
131   GetClientRect(window->hwnd, &client);
132   window->target->set_bounds(rect_width(&client), rect_height(&client), window->monitor->get_aspect());
133   return &window->target->get_primitives();
131   GetClientRect(window->m_hwnd, &client);
132   window->m_target->set_bounds(rect_width(&client), rect_height(&client), window->m_monitor->get_aspect());
133   return &window->m_target->get_primitives();
134134}
135135
136136
r31541r31542
141141
142142static int drawgdi_window_draw(win_window_info *window, HDC dc, int update)
143143{
144   gdi_info *gdi = (gdi_info *)window->drawdata;
144   gdi_info *gdi = (gdi_info *)window->m_drawdata;
145145   int width, height, pitch;
146146   RECT bounds;
147147
148148   // we don't have any special resize behaviors
149   if (window->resize_state == RESIZE_STATE_PENDING)
150      window->resize_state = RESIZE_STATE_NORMAL;
149   if (window->m_resize_state == RESIZE_STATE_PENDING)
150      window->m_resize_state = RESIZE_STATE_NORMAL;
151151
152152   // get the target bounds
153   GetClientRect(window->hwnd, &bounds);
153   GetClientRect(window->m_hwnd, &bounds);
154154
155155   // compute width/height/pitch of target
156156   width = rect_width(&bounds);
r31541r31542
166166   }
167167
168168   // draw the primitives to the bitmap
169   window->primlist->acquire_lock();
170   software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window->primlist, gdi->bmdata, width, height, pitch);
171   window->primlist->release_lock();
169   window->m_primlist->acquire_lock();
170   software_renderer<UINT32, 0,0,0, 16,8,0>::draw_primitives(*window->m_primlist, gdi->bmdata, width, height, pitch);
171   window->m_primlist->release_lock();
172172
173173   // fill in bitmap-specific info
174174   gdi->bminfo.bmiHeader.biWidth = pitch;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team