Ticket #5: 20-nd-theme-standard-multihead-support.patch

  • src/themes/standard/theme.c

    old new  
    237237get_notification_arrow_type(GtkWidget *nw) 
    238238{ 
    239239    WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); 
    240     int screen_height; 
    241240 
    242     screen_height = gdk_screen_get_height( 
    243         gdk_drawable_get_screen(GDK_DRAWABLE(nw->window))); 
     241    GdkScreen *screen; 
     242    int monitor; 
     243    GdkRectangle monitor_geometry; 
     244     
     245    screen = gdk_drawable_get_screen(GDK_DRAWABLE(nw->window)); 
     246    monitor = gdk_screen_get_monitor_at_point(screen, windata->point_x, windata->point_y); 
     247    gdk_screen_get_monitor_geometry(screen, monitor, &monitor_geometry); 
    244248 
    245     if (windata->point_y + windata->height + DEFAULT_ARROW_HEIGHT > 
    246         screen_height) 
     249    if ((windata->point_y - monitor_geometry.y) + windata->height + DEFAULT_ARROW_HEIGHT > 
     250        monitor_geometry.height) 
    247251    { 
    248252        return GTK_ARROW_DOWN; 
    249253    } 
     
    270274    int y; 
    271275    GtkArrowType arrow_type; 
    272276    GdkScreen *screen; 
    273     int screen_width; 
    274     int screen_height; 
    275277    int arrow_side1_width = DEFAULT_ARROW_WIDTH / 2; 
    276278    int arrow_side2_width = DEFAULT_ARROW_WIDTH / 2; 
    277279    int arrow_offset = DEFAULT_ARROW_OFFSET; 
    278280    GdkPoint *shape_points = NULL; 
    279281    int i = 0; 
     282    int monitor; 
     283    GdkRectangle monitor_geometry; 
    280284 
    281285    width  = windata->width; 
    282286    height = windata->height; 
    283287 
    284288    screen        = gdk_drawable_get_screen(GDK_DRAWABLE(nw->window)); 
    285     screen_width  = gdk_screen_get_width(screen); 
    286     screen_height = gdk_screen_get_height(screen); 
     289    monitor       = gdk_screen_get_monitor_at_point(screen, windata->point_x, windata->point_y); 
     290    gdk_screen_get_monitor_geometry(screen, monitor, &monitor_geometry); 
    287291 
    288292    windata->num_border_points = 5; 
    289293 
     
    294298    { 
    295299        case GTK_ARROW_UP: 
    296300        case GTK_ARROW_DOWN: 
    297             if (windata->point_x < arrow_side1_width) 
     301            if ((windata->point_x - monitor_geometry.x) < arrow_side1_width) 
    298302            { 
    299303                arrow_side1_width = 0; 
    300304                arrow_offset = 0; 
    301305            } 
    302             else if (windata->point_x > screen_width - arrow_side2_width
     306            else if ((windata->point_x - monitor_geometry.x) > (monitor_geometry.width - arrow_side2_width)
    303307            { 
    304308                arrow_side2_width = 0; 
    305309                arrow_offset = width - arrow_side1_width; 
    306310            } 
    307311            else 
    308312            { 
    309                 if (windata->point_x - arrow_side2_width + width >= 
    310                     screen_width) 
     313                if ((windata->point_x - monitor_geometry.x) - arrow_side2_width + width >= 
     314                    monitor_geometry.width) 
    311315                { 
    312316                    arrow_offset = 
    313317                        width - arrow_side1_width - arrow_side2_width - 
    314                         (screen_width - MAX(windata->point_x
     318                        (monitor_geometry.width - MAX((windata->point_x - monitor_geometry.x)
    315319                                            arrow_side1_width, 
    316                                             screen_width - 
     320                                            monitor_geometry.width - 
    317321                                            DEFAULT_ARROW_OFFSET)); 
    318322                } 
    319323                else 
    320324                { 
    321                     arrow_offset = MIN(windata->point_x - arrow_side1_width, 
     325                    arrow_offset = MIN((windata->point_x - monitor_geometry.x) - arrow_side1_width, 
    322326                                       DEFAULT_ARROW_OFFSET); 
    323327                } 
    324328 
     
    439443 
    440444        case GTK_ARROW_LEFT: 
    441445        case GTK_ARROW_RIGHT: 
    442             if (windata->point_y < arrow_side1_width) 
     446            if ((windata->point_y - monitor_geometry.y) < arrow_side1_width) 
    443447            { 
    444448                arrow_side1_width = 0; 
    445                 arrow_offset = windata->point_y
     449                arrow_offset = (windata->point_y - monitor_geometry.y)
    446450            } 
    447             else if (windata->point_y > screen_height - arrow_side2_width) 
     451            else if ((windata->point_y - monitor_geometry.y) > monitor_geometry.height - arrow_side2_width) 
    448452            { 
    449453                arrow_side2_width = 0; 
    450                 arrow_offset = windata->point_y - arrow_side1_width; 
     454                arrow_offset = (windata->point_y - monitor_geometry.y) - arrow_side1_width; 
    451455            } 
    452456            break; 
    453457