Подробности
[В начало]
Проблема в реализации № D0138
Краткое описание
Поведение функции gdk_selection_owner_set_for_display() не соответствует требованиям стандарта LSB 3.2
Подробное описание
В документации GDK-2.8.2, на которую ссылается стандарт LSB 3.2, функция gdk_selection_owner_set_for_display должна сгенерировать событие SelectionClear, когда параметр функции send_event = TRUE и новый владелец selection отличен от старого владельца, но функция не генерирует это событие. Причина этого, по моему мнению, заключается в том, что в коде функции вообще не используется параметр send_event.
Раздел стандарта
Linux Standard Base Desktop Specification 3.2. Chapter 15. Libraries. 15.21.1.1. Interfaces for GTK Drawing toolkit, который ссылается на http://www.gtk.org/api/2.6/gdk/gdk-Selections.html#gdk-selection-owner-set-for-display
Пример
#include <gdk/gdk.h> #include <glib.h> #include <stdio.h> #define SELECTION GDK_SELECTION_PRIMARY int main (int argc, char **argv) { GdkWindow *first_owner = NULL; GdkWindowAttr first_owner_attr; GdkWindow *second_owner = NULL; GdkWindowAttr second_owner_attr; GdkDisplay *display = NULL; GdkEvent *event = NULL; gboolean sel_clear_event = FALSE; gdk_init(&argc, &argv); display = gdk_display_get_default(); if(display == NULL) { printf("The gdk_display_get_default function returned NULL, unable to create GdkDisplay.\n"); return 0; } first_owner_attr.title = "FIRST_OWNER"; first_owner_attr.x = 3; first_owner_attr.y = 3; first_owner_attr.width = 500; first_owner_attr.height = 600; first_owner_attr.wclass = GDK_INPUT_OUTPUT; first_owner_attr.window_type = GDK_WINDOW_TOPLEVEL; first_owner_attr.event_mask = GDK_ALL_EVENTS_MASK; first_owner = gdk_window_new(NULL, &first_owner_attr, GDK_WA_X | GDK_WA_Y |GDK_WA_TITLE); if(first_owner == NULL) { printf("The gdk_window_new function returned NULL, unable to create GdkWindow.\n"); return 0; } second_owner_attr.title = "SECOND_OWNER"; second_owner_attr.x = 3; second_owner_attr.y = 3; second_owner_attr.width = 500; second_owner_attr.height = 600; second_owner_attr.wclass = GDK_INPUT_OUTPUT; second_owner_attr.window_type = GDK_WINDOW_TOPLEVEL; second_owner_attr.event_mask = GDK_ALL_EVENTS_MASK; second_owner = gdk_window_new(NULL, &second_owner_attr, GDK_WA_X | GDK_WA_Y |GDK_WA_TITLE); if(second_owner == NULL) { printf("The gdk_window_new function returned NULL, unable to create GdkWindow.\n"); return 0; } gdk_window_show(first_owner); gdk_window_show(second_owner); gdk_selection_owner_set_for_display(display, first_owner, SELECTION, GDK_CURRENT_TIME, FALSE); gdk_selection_owner_set_for_display(display, second_owner, SELECTION, GDK_CURRENT_TIME, TRUE); sleep(1); while((event = gdk_event_get()) != NULL) { if(event->type == GDK_SELECTION_CLEAR) { sel_clear_event = TRUE; break; } } if(sel_clear_event == FALSE) { printf("The function should send the GDK_SELECTION_CLEAR evenrt, but it doesn't"); } if(first_owner != NULL) { gdk_window_destroy(first_owner); } if(second_owner != NULL) { gdk_window_destroy(second_owner); } if(event != NULL) { gdk_event_free(event); } if(display != NULL) { gdk_display_close(display); } return 0; }
Компонент
gtk+ 2.17.10 or early
Принято
Gnome Bugzilla, 593653
[В начало]