Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #49 from jhoffmannrim/develop

updates to samples
  • Loading branch information...
commit 1a9f6b98f2f5835c2f03412339f36d3b9c87377d 2 parents f48c504 + 2b5c152
@jhoffmannrim jhoffmannrim authored
View
2  .gitignore
@@ -25,6 +25,8 @@ AudioControl/arm/o.le-v7-g/AudioControl
AudioControl/arm/o.le-v7/AudioControl
AudioControl/x86/o-g/AudioControl
AudioControl/x86/o/AudioControl
+Camera/arm/o.le-v7-g/Camera
+Camera/arm/o.le-v7/Camera
Channels/arm/o.le-v7-g/Channels
Channels/arm/o.le-v7/Channels
Channels/x86/o-g/Channels
View
45 Accelerometer/dialogutil.c
@@ -49,12 +49,6 @@ setup_screen()
return EXIT_FAILURE;
}
- //Signal BPS library that navigator orientation is to be locked
- if (BPS_SUCCESS != navigator_rotation_lock(true)) {
- screen_destroy_context(screen_ctx);
- return EXIT_FAILURE;
- }
-
if (screen_create_window(&screen_win, screen_ctx) != 0) {
screen_destroy_context(screen_ctx);
return EXIT_FAILURE;
@@ -65,37 +59,16 @@ setup_screen()
int usage = SCREEN_USAGE_NATIVE;
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage) != 0) goto fail;
- int size[2];
- if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
-
- screen_display_t screen_disp;
- screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp);
-
- screen_display_mode_t screen_mode;
- if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode) != 0) goto fail;
-
- int buffer_size[2] = {size[0], size[1]};
-
- int angle = atoi(getenv("ORIENTATION"));
- if ((angle == 0) || (angle == 180)) {
- if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
- ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else if ((angle == 90) || (angle == 270)){
- if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
- ((screen_mode.width < screen_mode.height && size[0] < size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else {
- goto fail;
- }
+ const char *env = getenv("WIDTH");
+ if (0 == env) goto fail;
+ int width = atoi(env);
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size) != 0) goto fail;
+ env = getenv("HEIGHT");
+ if (0 == env) goto fail;
+ int height = atoi(env);
+ int size[2] = { width, height };
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle) != 0) goto fail;
+ if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
if (screen_create_window_buffers(screen_win, 1) != 0) goto fail;
@@ -105,7 +78,7 @@ setup_screen()
int attribs[1] = {SCREEN_BLIT_END};
if (screen_fill(screen_ctx, buff, attribs) != 0) goto fail;
- int dirty_rects[4] = {0, 0, buffer_size[0], buffer_size[1]};
+ int dirty_rects[4] = {0, 0, width, height};
if (screen_post_window(screen_win, buff, 1, (const int*)dirty_rects, 0) != 0) goto fail;
return EXIT_SUCCESS;
View
45 AudioControl/dialogutil.c
@@ -49,12 +49,6 @@ setup_screen()
return EXIT_FAILURE;
}
- //Signal BPS library that navigator orientation is to be locked
- if (BPS_SUCCESS != navigator_rotation_lock(true)) {
- screen_destroy_context(screen_ctx);
- return EXIT_FAILURE;
- }
-
if (screen_create_window(&screen_win, screen_ctx) != 0) {
screen_destroy_context(screen_ctx);
return EXIT_FAILURE;
@@ -65,37 +59,16 @@ setup_screen()
int usage = SCREEN_USAGE_NATIVE;
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage) != 0) goto fail;
- int size[2];
- if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
-
- screen_display_t screen_disp;
- screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp);
-
- screen_display_mode_t screen_mode;
- if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode) != 0) goto fail;
-
- int buffer_size[2] = {size[0], size[1]};
-
- int angle = atoi(getenv("ORIENTATION"));
- if ((angle == 0) || (angle == 180)) {
- if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
- ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else if ((angle == 90) || (angle == 270)){
- if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
- ((screen_mode.width < screen_mode.height && size[0] < size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else {
- goto fail;
- }
+ const char *env = getenv("WIDTH");
+ if (0 == env) goto fail;
+ int width = atoi(env);
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size) != 0) goto fail;
+ env = getenv("HEIGHT");
+ if (0 == env) goto fail;
+ int height = atoi(env);
+ int size[2] = { width, height };
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle) != 0) goto fail;
+ if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
if (screen_create_window_buffers(screen_win, 1) != 0) goto fail;
@@ -105,7 +78,7 @@ setup_screen()
int attribs[1] = {SCREEN_BLIT_END};
if (screen_fill(screen_ctx, buff, attribs) != 0) goto fail;
- int dirty_rects[4] = {0, 0, buffer_size[0], buffer_size[1]};
+ int dirty_rects[4] = {0, 0, width, height};
if (screen_post_window(screen_win, buff, 1, (const int*)dirty_rects, 0) != 0) goto fail;
return EXIT_SUCCESS;
View
15 AudioControl/main.c
@@ -53,12 +53,15 @@ bool_str(bool b) {
*/
static const char*
get_channel_name(audiomixer_output_t output) {
- if (output == AUDIOMIXER_OUTPUT_SPEAKER)
- return "Speaker";
- if (output == AUDIOMIXER_OUTPUT_HEADPHONE)
- return "Headphones";
-
- return "Unknown";
+ static const char *channel_name[] = { "Default", "Speaker", "Headphone", "Headset", "Handset",
+ "A2DP", "BTSCO", "HAC", "HDMI", "Toslink", "TTY", "Lineout" };
+ static const int num_channels = sizeof(channel_name) / sizeof(*channel_name);
+
+ if (output < 0 || output >= num_channels) {
+ return "Unknown";
+ } else {
+ return channel_name[output];
+ }
}
/**
View
47 Channels/dialogutil.c
@@ -51,12 +51,6 @@ setup_screen()
return EXIT_FAILURE;
}
- //Signal BPS library that navigator orientation is to be locked
- if (BPS_SUCCESS != navigator_rotation_lock(true)) {
- screen_destroy_context(screen_ctx);
- return EXIT_FAILURE;
- }
-
if (screen_create_window(&screen_win, screen_ctx) != 0) {
screen_destroy_context(screen_ctx);
return EXIT_FAILURE;
@@ -67,37 +61,16 @@ setup_screen()
int usage = SCREEN_USAGE_NATIVE;
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage) != 0) goto fail;
- int size[2];
- if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
-
- screen_display_t screen_disp;
- screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp);
-
- screen_display_mode_t screen_mode;
- if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode) != 0) goto fail;
-
- int buffer_size[2] = {size[0], size[1]};
-
- int angle = atoi(getenv("ORIENTATION"));
- if ((angle == 0) || (angle == 180)) {
- if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
- ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else if ((angle == 90) || (angle == 270)){
- if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
- ((screen_mode.width < screen_mode.height && size[0] < size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else {
- goto fail;
- }
+ const char *env = getenv("WIDTH");
+ if (0 == env) goto fail;
+ int width = atoi(env);
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size) != 0) goto fail;
+ env = getenv("HEIGHT");
+ if (0 == env) goto fail;
+ int height = atoi(env);
+ int size[2] = { width, height };
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle) != 0) goto fail;
+ if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
if (screen_create_window_buffers(screen_win, 1) != 0) goto fail;
@@ -107,7 +80,7 @@ setup_screen()
int attribs[1] = {SCREEN_BLIT_END};
if (screen_fill(screen_ctx, buff, attribs) != 0) goto fail;
- int dirty_rects[4] = {0, 0, buffer_size[0], buffer_size[1]};
+ int dirty_rects[4] = {0, 0, width, height};
if (screen_post_window(screen_win, buff, 1, (const int*)dirty_rects, 0) != 0) goto fail;
return EXIT_SUCCESS;
@@ -179,8 +152,6 @@ show_geolocation_dialog_message(const char * msg) {
fprintf(stderr, "%s\n", msg);
}
-
-
void
show_accelerometer_dialog_message(const char * msg) {
dialog_set_alert_message_text(accelerometer_dialog, msg);
View
4 Dialog/main.c
@@ -87,7 +87,7 @@ setup_screen()
}
/**
- * Show an alert dialog that has two buttons: a "Cancel" button, and a "Submit" button.
+ * Show an alert dialog that has two buttons: a "Cancel" button, and a "OK" button.
*/
static void
show_alert()
@@ -126,7 +126,7 @@ show_alert()
/*
* Use a button label of our own. Don't attach a context to the button.
*/
- if (dialog_add_button(alert_dialog, "Submit", true, 0, true) != BPS_SUCCESS) {
+ if (dialog_add_button(alert_dialog, DIALOG_OK_LABEL, true, 0, true) != BPS_SUCCESS) {
fprintf(stderr, "Failed to add button to alert dialog.");
dialog_destroy(alert_dialog);
alert_dialog = 0;
View
45 Geolocation/dialogutil.c
@@ -49,12 +49,6 @@ setup_screen()
return EXIT_FAILURE;
}
- //Signal BPS library that navigator orientation is to be locked
- if (BPS_SUCCESS != navigator_rotation_lock(true)) {
- screen_destroy_context(screen_ctx);
- return EXIT_FAILURE;
- }
-
if (screen_create_window(&screen_win, screen_ctx) != 0) {
screen_destroy_context(screen_ctx);
return EXIT_FAILURE;
@@ -65,37 +59,16 @@ setup_screen()
int usage = SCREEN_USAGE_NATIVE;
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage) != 0) goto fail;
- int size[2];
- if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
-
- screen_display_t screen_disp;
- screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp);
-
- screen_display_mode_t screen_mode;
- if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode) != 0) goto fail;
-
- int buffer_size[2] = {size[0], size[1]};
-
- int angle = atoi(getenv("ORIENTATION"));
- if ((angle == 0) || (angle == 180)) {
- if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
- ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else if ((angle == 90) || (angle == 270)){
- if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
- ((screen_mode.width < screen_mode.height && size[0] < size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else {
- goto fail;
- }
+ const char *env = getenv("WIDTH");
+ if (0 == env) goto fail;
+ int width = atoi(env);
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size) != 0) goto fail;
+ env = getenv("HEIGHT");
+ if (0 == env) goto fail;
+ int height = atoi(env);
+ int size[2] = { width, height };
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle) != 0) goto fail;
+ if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
if (screen_create_window_buffers(screen_win, 1) != 0) goto fail;
@@ -105,7 +78,7 @@ setup_screen()
int attribs[1] = {SCREEN_BLIT_END};
if (screen_fill(screen_ctx, buff, attribs) != 0) goto fail;
- int dirty_rects[4] = {0, 0, buffer_size[0], buffer_size[1]};
+ int dirty_rects[4] = {0, 0, width, height};
if (screen_post_window(screen_win, buff, 1, (const int*)dirty_rects, 0) != 0) goto fail;
return EXIT_SUCCESS;
View
45 HttpProxy/dialogutil.c
@@ -49,12 +49,6 @@ setup_screen()
return EXIT_FAILURE;
}
- //Signal BPS library that navigator orientation is to be locked
- if (BPS_SUCCESS != navigator_rotation_lock(true)) {
- screen_destroy_context(screen_ctx);
- return EXIT_FAILURE;
- }
-
if (screen_create_window(&screen_win, screen_ctx) != 0) {
screen_destroy_context(screen_ctx);
return EXIT_FAILURE;
@@ -65,37 +59,16 @@ setup_screen()
int usage = SCREEN_USAGE_NATIVE;
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage) != 0) goto fail;
- int size[2];
- if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
-
- screen_display_t screen_disp;
- screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp);
-
- screen_display_mode_t screen_mode;
- if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode) != 0) goto fail;
-
- int buffer_size[2] = {size[0], size[1]};
-
- int angle = atoi(getenv("ORIENTATION"));
- if ((angle == 0) || (angle == 180)) {
- if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
- ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else if ((angle == 90) || (angle == 270)){
- if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
- ((screen_mode.width < screen_mode.height && size[0] < size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else {
- goto fail;
- }
+ const char *env = getenv("WIDTH");
+ if (0 == env) goto fail;
+ int width = atoi(env);
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size) != 0) goto fail;
+ env = getenv("HEIGHT");
+ if (0 == env) goto fail;
+ int height = atoi(env);
+ int size[2] = { width, height };
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle) != 0) goto fail;
+ if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
if (screen_create_window_buffers(screen_win, 1) != 0) goto fail;
@@ -105,7 +78,7 @@ setup_screen()
int attribs[1] = {SCREEN_BLIT_END};
if (screen_fill(screen_ctx, buff, attribs) != 0) goto fail;
- int dirty_rects[4] = {0, 0, buffer_size[0], buffer_size[1]};
+ int dirty_rects[4] = {0, 0, width, height};
if (screen_post_window(screen_win, buff, 1, (const int*)dirty_rects, 0) != 0) goto fail;
return EXIT_SUCCESS;
View
45 LocaleSample/dialogutil.c
@@ -49,12 +49,6 @@ setup_screen()
return EXIT_FAILURE;
}
- //Signal BPS library that navigator orientation is to be locked
- if (BPS_SUCCESS != navigator_rotation_lock(true)) {
- screen_destroy_context(screen_ctx);
- return EXIT_FAILURE;
- }
-
if (screen_create_window(&screen_win, screen_ctx) != 0) {
screen_destroy_context(screen_ctx);
return EXIT_FAILURE;
@@ -65,37 +59,16 @@ setup_screen()
int usage = SCREEN_USAGE_NATIVE;
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage) != 0) goto fail;
- int size[2];
- if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
-
- screen_display_t screen_disp;
- screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp);
-
- screen_display_mode_t screen_mode;
- if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode) != 0) goto fail;
-
- int buffer_size[2] = {size[0], size[1]};
-
- int angle = atoi(getenv("ORIENTATION"));
- if ((angle == 0) || (angle == 180)) {
- if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
- ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else if ((angle == 90) || (angle == 270)){
- if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
- ((screen_mode.width < screen_mode.height && size[0] < size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else {
- goto fail;
- }
+ const char *env = getenv("WIDTH");
+ if (0 == env) goto fail;
+ int width = atoi(env);
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size) != 0) goto fail;
+ env = getenv("HEIGHT");
+ if (0 == env) goto fail;
+ int height = atoi(env);
+ int size[2] = { width, height };
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle) != 0) goto fail;
+ if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
if (screen_create_window_buffers(screen_win, 1) != 0) goto fail;
@@ -105,7 +78,7 @@ setup_screen()
int attribs[1] = {SCREEN_BLIT_END};
if (screen_fill(screen_ctx, buff, attribs) != 0) goto fail;
- int dirty_rects[4] = {0, 0, buffer_size[0], buffer_size[1]};
+ int dirty_rects[4] = {0, 0, width, height};
if (screen_post_window(screen_win, buff, 1, (const int*)dirty_rects, 0) != 0) goto fail;
return EXIT_SUCCESS;
View
45 NetworkStatus/dialogutil.c
@@ -49,12 +49,6 @@ setup_screen()
return EXIT_FAILURE;
}
- //Signal BPS library that navigator orientation is to be locked
- if (BPS_SUCCESS != navigator_rotation_lock(true)) {
- screen_destroy_context(screen_ctx);
- return EXIT_FAILURE;
- }
-
if (screen_create_window(&screen_win, screen_ctx) != 0) {
screen_destroy_context(screen_ctx);
return EXIT_FAILURE;
@@ -65,37 +59,16 @@ setup_screen()
int usage = SCREEN_USAGE_NATIVE;
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage) != 0) goto fail;
- int size[2];
- if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
-
- screen_display_t screen_disp;
- screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp);
-
- screen_display_mode_t screen_mode;
- if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode) != 0) goto fail;
-
- int buffer_size[2] = {size[0], size[1]};
-
- int angle = atoi(getenv("ORIENTATION"));
- if ((angle == 0) || (angle == 180)) {
- if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
- ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else if ((angle == 90) || (angle == 270)){
- if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
- ((screen_mode.width < screen_mode.height && size[0] < size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else {
- goto fail;
- }
+ const char *env = getenv("WIDTH");
+ if (0 == env) goto fail;
+ int width = atoi(env);
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size) != 0) goto fail;
+ env = getenv("HEIGHT");
+ if (0 == env) goto fail;
+ int height = atoi(env);
+ int size[2] = { width, height };
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle) != 0) goto fail;
+ if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
if (screen_create_window_buffers(screen_win, 1) != 0) goto fail;
@@ -105,7 +78,7 @@ setup_screen()
int attribs[1] = {SCREEN_BLIT_END};
if (screen_fill(screen_ctx, buff, attribs) != 0) goto fail;
- int dirty_rects[4] = {0, 0, buffer_size[0], buffer_size[1]};
+ int dirty_rects[4] = {0, 0, width, height};
if (screen_post_window(screen_win, buff, 1, (const int*)dirty_rects, 0) != 0) goto fail;
return EXIT_SUCCESS;
View
45 PlayWav/dialogutil.c
@@ -49,12 +49,6 @@ setup_screen()
return EXIT_FAILURE;
}
- //Signal BPS library that navigator orientation is to be locked
- if (BPS_SUCCESS != navigator_rotation_lock(true)) {
- screen_destroy_context(screen_ctx);
- return EXIT_FAILURE;
- }
-
if (screen_create_window(&screen_win, screen_ctx) != 0) {
screen_destroy_context(screen_ctx);
return EXIT_FAILURE;
@@ -65,37 +59,16 @@ setup_screen()
int usage = SCREEN_USAGE_NATIVE;
if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage) != 0) goto fail;
- int size[2];
- if (screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
-
- screen_display_t screen_disp;
- screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_DISPLAY, (void **)&screen_disp);
-
- screen_display_mode_t screen_mode;
- if (screen_get_display_property_pv(screen_disp, SCREEN_PROPERTY_MODE, (void**)&screen_mode) != 0) goto fail;
-
- int buffer_size[2] = {size[0], size[1]};
-
- int angle = atoi(getenv("ORIENTATION"));
- if ((angle == 0) || (angle == 180)) {
- if (((screen_mode.width > screen_mode.height) && (size[0] < size[1])) ||
- ((screen_mode.width < screen_mode.height) && (size[0] > size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else if ((angle == 90) || (angle == 270)){
- if (((screen_mode.width > screen_mode.height) && (size[0] > size[1])) ||
- ((screen_mode.width < screen_mode.height && size[0] < size[1]))) {
- buffer_size[1] = size[0];
- buffer_size[0] = size[1];
- }
- } else {
- goto fail;
- }
+ const char *env = getenv("WIDTH");
+ if (0 == env) goto fail;
+ int width = atoi(env);
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, buffer_size) != 0) goto fail;
+ env = getenv("HEIGHT");
+ if (0 == env) goto fail;
+ int height = atoi(env);
+ int size[2] = { width, height };
- if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_ROTATION, &angle) != 0) goto fail;
+ if (screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0) goto fail;
if (screen_create_window_buffers(screen_win, 1) != 0) goto fail;
@@ -105,7 +78,7 @@ setup_screen()
int attribs[1] = {SCREEN_BLIT_END};
if (screen_fill(screen_ctx, buff, attribs) != 0) goto fail;
- int dirty_rects[4] = {0, 0, buffer_size[0], buffer_size[1]};
+ int dirty_rects[4] = {0, 0, width, height};
if (screen_post_window(screen_win, buff, 1, (const int*)dirty_rects, 0) != 0) goto fail;
return EXIT_SUCCESS;

0 comments on commit 1a9f6b9

Please sign in to comment.
Something went wrong with that request. Please try again.