Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions bin/backlight_helper/ddcci/ddcci.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@ func newDDCCI() (*ddcci, error) {
displayHandleMap: make(map[string]*displayHandle),
}

status := C.ddca_init2((*C.char)(unsafe.Pointer(nil)), C.DDCA_SYSLOG_NOTICE, C.DDCA_INIT_OPTIONS_CLIENT_OPENED_SYSLOG, (***C.char)(unsafe.Pointer(nil)))
if status < C.int(0) {
return nil, fmt.Errorf("brightness: Error ddcci init: %d", status)
}

err := ddc.RefreshDisplays()
if err != nil {
return nil, err
Expand Down
1 change: 1 addition & 0 deletions bin/backlight_helper/ddcci/ddcci_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ int freeAllDisplaysWrapper() {
if (fp_ddca_free_all_displays) {
return fp_ddca_free_all_displays();
}
return -1;
}
8 changes: 7 additions & 1 deletion keybinding1/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -930,8 +930,14 @@ func (m *Manager) handleKeyEventByWayland(changKey string) {
logger.Warningf("get wireless enabled failed, err: %v", err)
return
}
// FIXME: 修复NM WiFi无法恢复bug, 使快捷键能够恢复WiFi问题
if !enabled {
type networkDevice struct {
InterfaceFlags uint32 `json:"interface_flags"`
}
// The following code is intended to fix a bug where NetworkManager WiFi
// cannot be restored using a shortcut key. It checks if any wireless
// network interfaces are down (InterfaceFlags == 0) and, if so,
// toggles the wireless adapter off and on to reset the state.
if devicesJson, err := m.network.Devices().Get(0); err == nil {
networkDevices := make(map[string][]*networkDevice)
json.Unmarshal([]byte(devicesJson), &networkDevices)
Expand Down
9 changes: 9 additions & 0 deletions keybinding1/manager_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package keybinding

import (
"testing"
)

func TestFix(t *testing.T) {

}
Comment on lines +7 to +9
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (testing): TestFix is empty and does not verify any functionality.

Please add tests that cover WiFi restoration and the related bugfix, including scenarios where the wireless adapter is down.

3 changes: 2 additions & 1 deletion keybinding1/shortcuts/keystroke.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ func ParseKeystrokes(keystrokes []string) []*Keystroke {
parsed, err := ParseKeystroke(keystroke)
if err == nil {
result = append(result, parsed)
} else {
logger.Warningf("failed to parse keystroke %q: %v", keystroke, err)
}
// TODO else warning
}
return result
}
Expand Down
30 changes: 5 additions & 25 deletions keybinding1/shortcuts/shortcut_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ func (sm *ShortcutManager) NotifyLayoutChanged() {
}

func (sm *ShortcutManager) Destroy() {
// TODO
if sm.dataConn != nil {
record.FreeContext(sm.conn, sm.recordContext)
sm.dataConn.Close()
sm.dataConn = nil
}
}

func (sm *ShortcutManager) List() (list []Shortcut) {
Expand Down Expand Up @@ -1238,30 +1242,6 @@ func (sm *ShortcutManager) AddSystem(wmObj wm.Wm) {
}
}

// TODO delete, because not used
// func (sm *ShortcutManager) AddWM(gsettings *gio.Settings, wmObj wm.Wm) {
// logger.Debug("AddWM")
// idNameMap := getWMIdNameMap()
// releaseType := getDeepinReleaseType()
// for _, id := range gsettings.ListKeys() {
// if releaseType == "Server" && strings.Contains(id, "workspace") {
// logger.Debugf("release type is server filter '%s'", id)
// continue
// }
// if id == "expose-all-windows" || id == "expose-windows" {
// logger.Debugf("'%s' is abandoned!", id)
// continue
// }
// name := idNameMap[id]
// if name == "" {
// name = id
// }
// keystrokes := gsettings.GetStrv(id)
// gs := NewShortcut(wmObj, id, ShortcutTypeWM, keystrokes, name)
// sm.addWithoutLock(gs)
// }
// }

func (sm *ShortcutManager) AddMedia(wmObj wm.Wm) {
logger.Debug("AddMedia")
idNameMap := getMediaIdNameMap()
Expand Down
Loading