Well, I was bored and this has bugged me a few times, so here's the fix: --- src/grandr.c.orig 2006-04-13 01:39:52.000000000 +0200 +++ src/grandr.c 2006-04-13 01:46:19.000000000 +0200 @@ -253,7 +253,7 @@
while (cur != NULL) { - if ((1 << grandr->xr_current_rotation) == ((Rotation) gtk_object_get_data(GTK_OBJECT(cur->data), "rotation_value") & 0xf )) + if ((grandr->xr_current_rotation >> (Rotation) gtk_object_get_data(GTK_OBJECT(cur->data), "rotation_value")) & 1) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (cur->data), TRUE); cur = g_slist_next(cur); It really is obvious, as "rotation_value" is an int between 0 and 3. I'm attaching a fuller diff that maintains prettier order between the menu entries. The above is the bug fixer, though. /Mikael mån 2005-09-19 klockan 09:26 +0200 skrev Sven Luther: > On Mon, Sep 19, 2005 at 09:07:27AM +0200, Mikael Nilsson wrote: > > Package: gnome-randr-applet > > Version: 0.2-1 > > Severity: important > > > > > > When I've just started Xorg and gnome (on my Dell inspiron 8200 laptop using > > an nvidia GeForce4 440 Go and nvidia drivers 7667), and check the options in > > the gnome-randr-applet menu, I get a menu with a lot of resolution options > > (same as xrandr), and a list of four rotations (same set as xrandr). > > Oh fun, i never saw gnome-randr work with anything but resolution changes, as > xfree86 was not supporting rotations. Will have to have a look, don't have > time for the next week or so though. > > > However, the selected rotation is "Inverted", which is incorrect. This is > > the output from > > xrandr: > > > > [EMAIL PROTECTED]:~$ xrandr > > SZ: Pixels Physical Refresh > > *0 1600 x 1200 ( 323mm x 242mm ) *60 > > 1 1280 x 1024 ( 323mm x 242mm ) 60 > > 2 1024 x 768 ( 323mm x 242mm ) 60 > > 3 800 x 600 ( 323mm x 242mm ) 60 56 > > 4 640 x 480 ( 323mm x 242mm ) 60 > > 5 1400 x 1050 ( 323mm x 242mm ) 60 > > 6 1440 x 900 ( 323mm x 242mm ) 60 > > 7 1280 x 960 ( 323mm x 242mm ) 60 > > 8 1280 x 800 ( 323mm x 242mm ) 60 > > 9 1280 x 768 ( 323mm x 242mm ) 60 > > 10 960 x 600 ( 323mm x 242mm ) 60 > > 11 840 x 525 ( 323mm x 242mm ) 60 > > 12 700 x 525 ( 323mm x 242mm ) 60 > > 13 640 x 512 ( 323mm x 242mm ) 60 > > 14 720 x 450 ( 323mm x 242mm ) 60 > > 15 640 x 400 ( 323mm x 242mm ) 60 > > 16 640 x 384 ( 323mm x 242mm ) 60 > > 17 512 x 384 ( 323mm x 242mm ) 60 > > 18 400 x 300 ( 323mm x 242mm ) 60 56 > > 19 320 x 240 ( 323mm x 242mm ) 60 > > Current rotation - normal > > Current reflection - none > > Rotations possible - normal left inverted right > > Reflections possible - none > > [EMAIL PROTECTED]:~$ > > > > > > The end result is that if I choose another resolution (for doing > > presentation on external projector), grandr also sets the rotation to > > inverted... Imagine me standing in front of a crowd full of expectations, > > only to see my screen upside down ("Oh, well, I'm using Linux" :-). > > > > Anyway, I hope there is a simple fix. > > Probably, maybe we should ping upstream even. > > Friendly, > > Sven Luther > -- Plus ça change, plus c'est la même chose
--- src/grandr.c.orig 2006-04-13 01:39:52.000000000 +0200 +++ src/grandr.c 2006-04-13 01:46:19.000000000 +0200 @@ -253,7 +253,7 @@ while (cur != NULL) { - if ((1 << grandr->xr_current_rotation) == ((Rotation) gtk_object_get_data(GTK_OBJECT(cur->data), "rotation_value") & 0xf )) + if ((grandr->xr_current_rotation >> (Rotation) gtk_object_get_data(GTK_OBJECT(cur->data), "rotation_value")) & 1) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (cur->data), TRUE); cur = g_slist_next(cur); @@ -314,37 +314,10 @@ grandr->xr_lock_updates = TRUE; - /* Size menu entries */ - - for (i = 0; i < grandr->xr_nsize; i++) - { - g_snprintf(tmp_buf, 128, "%5d x %-5d", - grandr->xr_sizes[i].width, grandr->xr_sizes[i].height ); - menu_item = gtk_radio_menu_item_new_with_label (group, tmp_buf); - group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item)); - - if (i == grandr->xr_current_size) - gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); - - gtk_object_set_data(GTK_OBJECT (menu_item), "size_index", (gpointer)i ); - - g_signal_connect (menu_item, "activate", - G_CALLBACK (menu_size_selected_cb), grandr ); - - gtk_menu_shell_append (GTK_MENU_SHELL (grandr->menu), menu_item); - - grandr->size_menu_items = g_slist_append (grandr->size_menu_items, (gpointer)menu_item ); - - gtk_widget_show (menu_item); - } - /* Rotation menu entrys */ if (grandr->xr_rotations > 1) { - menu_item = gtk_separator_menu_item_new (); - gtk_menu_shell_prepend (GTK_MENU_SHELL(grandr->menu), menu_item); - gtk_widget_show (menu_item); for (i = 0; i < 4; i ++) { @@ -357,14 +330,14 @@ gtk_object_set_data(GTK_OBJECT (menu_item), "rotation_value", (gpointer)i /*(grandr->xr_rotations >> i)*/ ); - if ((1 << i) == grandr->xr_current_rotation & 0xf) + if ((grandr->xr_current_rotation >> i ) & 1) gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); g_signal_connect (menu_item, "activate", G_CALLBACK (menu_rotation_selected_cb), grandr ); - gtk_menu_shell_prepend (GTK_MENU_SHELL(grandr->menu), + gtk_menu_shell_append (GTK_MENU_SHELL(grandr->menu), menu_item); grandr->rotate_menu_items = g_slist_append (grandr->rotate_menu_items, (gpointer)menu_item ); @@ -372,8 +345,37 @@ gtk_widget_show (menu_item); } } + menu_item = gtk_separator_menu_item_new (); + gtk_menu_shell_append (GTK_MENU_SHELL(grandr->menu), menu_item); + gtk_widget_show (menu_item); + } + /* Size menu entries */ + + for (i = 0; i < grandr->xr_nsize; i++) + { + g_snprintf(tmp_buf, 128, "%5d x %-5d", + grandr->xr_sizes[i].width, grandr->xr_sizes[i].height ); + menu_item = gtk_radio_menu_item_new_with_label (group, tmp_buf); + group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (menu_item)); + + if (i == grandr->xr_current_size) + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menu_item), TRUE); + + gtk_object_set_data(GTK_OBJECT (menu_item), "size_index", (gpointer)i ); + + g_signal_connect (menu_item, "activate", + G_CALLBACK (menu_size_selected_cb), grandr ); + + gtk_menu_shell_append (GTK_MENU_SHELL (grandr->menu), menu_item); + + grandr->size_menu_items = g_slist_append (grandr->size_menu_items, (gpointer)menu_item ); + + gtk_widget_show (menu_item); + } + + gtk_widget_show (grandr->menu); grandr->xr_lock_updates = FALSE;