void SwitchToFullscreenModeDx9(HWND hwnd) { video_canvas_t *c; fullscreen_transition = 1; c = video_canvas_for_hwnd(hwnd); video_device_release_dx9(c); statusbar_destroy(hwnd); /* Remove Window stuff that prevents fullscreen display */ old_style = GetWindowLong(hwnd, GWL_STYLE); GetWindowRect(hwnd, &old_rect); SetWindowLong(hwnd, GWL_STYLE, old_style & ~WS_SYSMENU & ~WS_CAPTION); old_menu = GetMenu(hwnd); SetMenu(hwnd, NULL); ShowCursor(FALSE); ui_set_render_window(c, 1); video_device_create_dx9(c, 1); video_canvas_refresh_all(c); fullscreen_active = 1; fullscreen_transition = 0; }
void SwitchToWindowedModeDx9(HWND hwnd) { video_canvas_t *c; fullscreen_transition = 1; c = video_canvas_for_hwnd(hwnd); video_device_release_dx9(c); /* Create statusbar here to get correct dimensions for client window */ statusbar_create(hwnd); ui_set_render_window(c, 0); LockWindowUpdate(hwnd); SetWindowLong(hwnd, GWL_STYLE, old_style); /* Restore Menu */ SetMenu(hwnd,old_menu); ui_show_menu(); SetWindowPos(hwnd, HWND_NOTOPMOST, old_rect.left, old_rect.top, old_rect.right - old_rect.left, old_rect.bottom - old_rect.top, SWP_NOCOPYBITS); ShowCursor(TRUE); LockWindowUpdate(NULL); video_device_create_dx9(c, 0); video_canvas_refresh_all(c); fullscreen_transition = 0; c->refreshrate = old_refreshrate; }
void video_canvas_update_dx9(HWND hwnd, HDC hdc, int xclient, int yclient, int w, int h) { video_canvas_t *canvas; canvas = video_canvas_for_hwnd(hwnd); if (canvas == NULL) { return; } /* Just refresh the whole canvas */ video_canvas_refresh_all(canvas); }
static void init_fullscreen_dialog(HWND hwnd) { HWND setting_hwnd; DirectDrawDeviceList *dev; ValueList *value; int xpos; int xstart; int xend; int distance; int size; double fval; TCHAR newval[64]; video_canvas_t *canvas; uilib_localize_dialog_param *fullscreen_dialog_trans = (video_dx9_enabled()) ? fullscreen_dialog_dx9_trans : fullscreen_dialog_ddraw_trans; uilib_dialog_group *fullscreen_left_group = (video_dx9_enabled()) ? fullscreen_left_dx9_group : fullscreen_left_ddraw_group; uilib_dialog_group *fullscreen_right_group = (video_dx9_enabled()) ? fullscreen_right_dx9_group : fullscreen_right_ddraw_group; canvas = video_canvas_for_hwnd(GetParent(GetParent(hwnd))); fullscreen_getmodes(); /* translate all dialog items */ uilib_localize_dialog(hwnd, fullscreen_dialog_trans); /* adjust the size of the elements in the left group */ uilib_adjust_group_width(hwnd, fullscreen_left_group); /* adjust the size of the elements in the rest group */ uilib_adjust_group_width(hwnd, fullscreen_rest_group); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, fullscreen_right_group, &xend); /* get the min x of the right group */ uilib_get_group_min_x(hwnd, fullscreen_right_group, &xstart); /* get the max x of the left group */ uilib_get_group_max_x(hwnd, fullscreen_left_group, &xpos); if (xpos + 10 > xstart) { /* set the position of the right group */ uilib_move_group(hwnd, fullscreen_right_group, xpos + 10); /* get the max x of the right group */ uilib_get_group_max_x(hwnd, fullscreen_right_group, &xpos); /* calculate the distance between the old and new max x of the right group */ distance = xpos - xend; /* get the size of the driver element */ uilib_get_element_size(hwnd, IDC_FULLSCREEN_DEVICE, &size); /* set the size of the driver element */ uilib_set_element_width(hwnd, IDC_FULLSCREEN_DEVICE, size + distance); } validate_mode(&fullscreen_device, &fullscreen_width, &fullscreen_height, &fullscreen_bitdepth, &fullscreen_refreshrate); setting_hwnd = GetDlgItem(hwnd, IDC_FULLSCREEN_DEVICE); SendMessage(setting_hwnd, CB_RESETCONTENT, 0, 0); dev = devices; while (dev != NULL) { SendMessage(setting_hwnd, CB_ADDSTRING, 0, (LPARAM)dev->desc); dev = dev->next; } SendMessage(setting_hwnd, CB_SETCURSEL, (WPARAM)fullscreen_device, 0); get_bitdepthlist(fullscreen_device); setting_hwnd = GetDlgItem(hwnd, IDC_FULLSCREEN_BITDEPTH); SendMessage(setting_hwnd, CB_RESETCONTENT, 0, 0); value = bitdepthlist; while (value != NULL) { SendMessage(setting_hwnd, CB_ADDSTRING, 0, (LPARAM)value->text); value = value->next; } SendMessage(setting_hwnd, CB_SETCURSEL, (WPARAM)GetIndexFromList(bitdepthlist, fullscreen_bitdepth), 0); get_resolutionlist(fullscreen_device, fullscreen_bitdepth); setting_hwnd = GetDlgItem(hwnd, IDC_FULLSCREEN_RESOLUTION); SendMessage(setting_hwnd, CB_RESETCONTENT, 0, 0); value = resolutionlist; while (value != NULL) { SendMessage(setting_hwnd, CB_ADDSTRING, 0, (LPARAM)value->text); value = value->next; } SendMessage(setting_hwnd, CB_SETCURSEL, (WPARAM)GetIndexFromList(resolutionlist, (fullscreen_width << 16) + fullscreen_height), 0); get_refreshratelist(fullscreen_device, fullscreen_bitdepth, fullscreen_width, fullscreen_height); setting_hwnd = GetDlgItem(hwnd, IDC_FULLSCREEN_REFRESHRATE); SendMessage(setting_hwnd, CB_RESETCONTENT, 0, 0); value = refresh_rates; while (value != NULL) { SendMessage(setting_hwnd, CB_ADDSTRING, 0, (LPARAM)value->text); value = value->next; } SendMessage(setting_hwnd, CB_SETCURSEL, (WPARAM)GetIndexFromList(refresh_rates, fullscreen_refreshrate), 0); EnableWindow(GetDlgItem(hwnd, IDC_TOGGLE_VIDEO_VBLANK_SYNC), !video_dx9_enabled()); CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_VBLANK_SYNC, vblank_sync ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_TOGGLE_VIDEO_DX_PRIMARY, dx_primary ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(hwnd, IDC_TOGGLE_KEEP_ASPECT_RATIO), video_dx9_enabled()); if (video_dx9_enabled()) { CheckDlgButton(hwnd, IDC_TOGGLE_KEEP_ASPECT_RATIO, keep_aspect_ratio ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_TOGGLE_TRUE_ASPECT_RATIO, true_aspect_ratio ? BST_CHECKED : BST_UNCHECKED); enable_aspect_ratio(hwnd); fval = ((double)aspect_ratio) / 1000.0; _stprintf(newval, TEXT("%.3f"), (float)fval); SetDlgItemText(hwnd, IDC_ASPECT_RATIO, newval); fval = canvas->geometry->pixel_aspect_ratio; _stprintf(newval, TEXT("%.3f"), (float)fval); SetDlgItemText(hwnd, IDC_GEOMETRY_ASPECT_RATIO, newval); } }